I'm trying to spec a view but haven't done much view specing.
This view render different partials depending on authentication of the user:
annon, admin, player
So I I'll write if conditionals in the view with the partials
it "should render signup propaganda for annon users trying to view games"
do
render "/games/index.rhtml"
@logged_in?.should eql(false)
response.should render_template('_signup_propaganda')
end
Now for my partial I know it'll be wrapped all in a div with a
class="signup_propaganda"
Should I be testing for that instead? Can I write expectations for partials
similar to above?
When your specing views are you testing for the outputted results?
it "should render signup propaganda for annon users trying to view games"
do
render "/games/index.rhtml"
@logged_in?.should eql(false)
response.should have_tag(div, "class=/"signup_propaganda/"")
end
How should I be writing my spec?
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users