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..
<div id=\"usermenu\">\r\nHello quentin
...
</div>
...
quentin is the first fixture in users, arthur is the second. It seems
like the get :index is not successfully putting the new user id in the
session.
Can anyone help me understand what''s going on?