kucaahbe / rspec-html-matchers

Old school have_tag, with_tag(and more) matchers for rspec 3 (Nokogiri powered)
http://rubygems.org/gems/rspec-html-matchers
MIT License
199 stars 90 forks source link

The tag contents isn't always a string (no method `gsub') #10

Closed cimm closed 13 years ago

cimm commented 13 years ago

The rspec2-rails-views-matchers expect a string and that won't always be the case. Take the following example where I want to show a simple integer:

it "shows the price of the item" do
  price = 100
  render
  rendered.should have_tag("#price", :text => price)
end

Returns the following error:

Failure/Error: rendered.should have_tag(".total_amount", :text => price)
  NoMethodError:
    undefined method `gsub' for 100:Fixnum

It does work fine when I use a string like price = "100". This makes it impossible to use integers (or mocks or any other object) with the gem.

kucaahbe commented 13 years ago

fixed in 0.2.1 thanks for pointing me to this!

cimm commented 13 years ago

Thanks again Dmitry! I tried it out with some mocks in my view tests and it works. Amazed by your fast bug fixing skills! :)