2016-12-19 539 views
1

我有錯誤消息./spec/models/lib/parsers/s_reality_cz/matcher_spec.rb:12:in'block(2 levels )in'在每個rspec測試中。我做錯了什麼?使用rspec-rails 3.5。由於ruby​​ rspec in <top(required)>'block(2 levels)''

代碼: 需要 '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

你看串相同,但他們可能有不同的編碼。 將它們轉換爲相同的編碼(例如UTF-8),並將它們進行比較。

+0

多麼容易:)謝謝你 – Matho

相關問題