我遇到错误信息./spec/models/lib/parsers/s_reality_cz/matcher_spec.rb:12:in块(2级)'在每个rspec测试中。我做错了什么?使用rspec-rails 3.5。感谢
代码: 要求' rails_helper'
RSpec.describe Parsers::SRealityCz::Matcher, :type=> :model do
before do
@doc = File.open("spec/fixtures/srealitycz_profile.html") { |f| Nokogiri::HTML(f) }
end
let(:parser) { described_class }
it "returns total price" do
expect(parser.title(@doc)).to eq "Prodej bytu 1+kk 40 m²"
end
end
Rspec输出:
Randomized with seed 37464
expected: "Prodej bytu 1+kk 40 m²"
got: "Prodej bytu 1+kk 40 m²"
(compared using ==)
./spec/models/lib/parsers/s_reality_cz/matcher_spec.rb:12:in `block (2 levels) in <top (required)>'
-e:1:in `load'
-e:1:in `<main>'
1 example, 1 failure, 0 passed
Finished in 0.139173354 seconds
答案 0 :(得分:0)
你的字符串看起来一样,但它们可能有不同的编码。
将它们转换为相同的编码(例如UTF-8
),并进行比较。