I tried googling a bit and only advice I found was to re-create the test and/or new.html.erb file(s) and make sure they’re saved as UTF-8. One was, other wasnt, so I saved them both as UTF-8 but unfortunately this did not help. Any ideas how to get the test to pass?
Thanks for the quick reply Mittineague.
Yes, that’s, well, almost what mine looks like. Just that when my rails created the skeleton file, it used a slightly different notation so I decided to stick with it (and it seemed to work just fine with all other test):
test "should show new form" do
assert_select "form p", :count => 3
So I just decided to move on and hope to fix that test later on. Everything worked just fine, until the next functional tests. Unit tests pass just fine, and all functional tests that don’t include assert_select pass as well. But the one that fails this time is:
test "should show story vote elements" do
get :show, :id => stories(:one)
assert_select 'h2 span#vote_score'
assert_select 'ul#vote_history li', :count => 2
assert_select 'div#vote_form form'
with this output:
Expected at least 1 element matching "h2 span#vote_score", found 0.
<false> is not true.
Again I’m quite certain there’s nothing wrong in the generated html itself, here’s a snippet from it:
Some random site
Sorry, I cannot post my DOCTYPE declaration either.
The point is that assert_select can fail if your views generate HTML that is incorrect in some way. Try simplifying your templates/views until assert_select works again.
As I said, in my case, removing the entire DOCTYPE declaration suddenly made assert_select do its job again, and so I knew that there had to be a mistake in that declaration. In your case it might be some other part of the HTML that is wrong: do all the tags that open, also close ? (You did not misspell a closing tag, for instance?) And what about the quotes?