[rspec-users] Newlines breaking "should have_tag :text =>" specs
Ashley Moran
work at ashleymoran.me.uk
Fri Apr 27 12:07:10 EDT 2007
Hi
I've got an RJS spec that is failing. It looks like this:
specify "should have list of prooducts for particular provider" do
@provider.products.each do |product|
response.should have_tag("#product_name_#{product.id}", :text
=> "#{product.name}")
end
end
It fails when it renders a partial containing this:
<td id="product_name_<%= product.id%>">
<%= product.name %>
</td>
and gives this error:
'A rendered show_provider_products_for_dealer view should have list
of prooducts for particular provider' FAILED
<"product 1"> expected but was
<"\\r\n product 1\\r">.
<false> is not true.
The following change makes it work:
<td id="product_name_<%= product.id%>"><%= product.name %
></td>
Bizarrely, while it fails on my Mac, it passes on Windows (both
running 0.8.2). Also it doesn't appear to affect RHTML specs, just RJS.
Any ideas?
Thanks
Ashley
More information about the rspec-users
mailing list