[rspec-users] AssertSelect for strings?

Tilmann Singer tils-rspec at tils.net
Fri Mar 9 10:03:50 EST 2007


Hi,

Is there a way to use the have_tag matcher on a string instead of the
response body from a view? I have a helper in a method rails project
that returns an html fragment which I would like to test.

Like this:

module SomeHelper
  def some_helper_method
    "<p>foo</p>"
  end
end

context "The SomeHelper"
  helper_name :some
  specify do 
    some_helper_method.should have_tag("p", "foo")
  end
end



Til


ps: the new have_tag / with_tag stuff for testing views and rspec
0.8.2 in general rocks, thanks to all involved!


More information about the rspec-users mailing list