[rspec-users] Rails views have_tag with html inside

Steve vertebrate at gmail.com
Fri Aug 1 15:19:19 EDT 2008


Is there a way to use "have_tag" to match tags with HTML content? I want 
this:

response.should have_tag('span#customer_address', '123 Main 
St.<br/>Anytown, FL 32803')

and that is what renders in the view, but it won't match because 
have_tag ignores the contained '<br/>'. I know that have_tag is based on 
HTMLSelector, so it's not specifically RSpec, but does anyone know how 
to work around this?

Thanks,
Steve



More information about the rspec-users mailing list