Embarrassingly late (apps already well advanced), have decided top get
to grips with testing and am having a week hopefully covering everything
I’ve already coded (so far it’s been worth it – found a couple of bugs
might not have found otherwise).
But having a bit of a prob with a functional test. I’m trying to
enumerate through through a list of users in a fixtures file, and test
against each one, but it’s doing something very weird. Here’s the basics
of the test
def test_index_user
User.find(:all).each do |user|
get :index, {}, {:user => user.id}
assert_response :success
assert_tag :tag => “div”,
:attributes => {
:id => “usermenu”
},
:content => /Hello\s#{user.login}/
end
end
What’s happening is that it’s failing, saying:
expected tag, but no tag found matching {:tag=>“div”,
:content=>/Hello\sarthur/, :attributes=>{:id=>“usermenu”}} in:
…#dump of tags including…
Can anyone help me understand what’s going on?