kucaahbe/rspec2-rails-views-matchers — Issue #11: Multiline strings
Author: cimm
Created: 2011-10-23 21:34:30+00:00
State: open

Not really a bug but I would like to know if this "works as designed" or if we could improve this a little bit. Suppose the following HTML snippet:

2011-10-23

And the following spec:

rendered.should have_tag(".payed_at", :text => "2011-10-23")

This won't work because of the line feeds in the HTML snippet. There are 2 ways around this. You could remove the line feeds in the HTML but that's not always the best solution or you could use a regex in the test like:

rendered.should have_tag(".payed_at", :text => /2011-10-23/)

When the date is a variable it gets a bit verbose `/#{payed_at.to_s}/` and when it's a mock it even more difficult... Am I nitpicking here of could we find a way in the API to tell the gem not to worry about the whitespace?

Thanks once again!