[rspec-users] spec'ing view render partial collection, local variable not found
Andrew WC Brown
omen.king at gmail.com
Fri Oct 5 21:30:52 EDT 2007
game = mock_model(Game, :name => 'The Battle for Blaze', :enabled =>
game.should_receive(:name).and_return('The Battle for Blaze')
@game = game
I still got the error but I saw in the print out 'The Battle for Blaze' and
So I for some reason thought that if I write unknowingly in my partial
<%= h game.enabled %> it might pass and it did.
I was thinking that game.should_recieve was test that the mock model being
made received Battle for the Blaze like I was confirming that the the model
But then I looked at the code and really thought about it and realized that
what it was saying that the Game model was expecting name to be called at
some point during that spec and since it hadn't been in the partial such as
game.name then it would fail.
When I'm working with RSpec I sometimes forget what actually is going on and
I interpret how things are happening in a different way.
For that pragmatic book will it cover things such as:
how to spec a rendered template
how to spec a rendered partial
how to spec a rendered partial collection
how to spec a cookie
or will it be more of a guide like the RSpec Peepcode videos but in book
format with more elaboration.
I don't think I would have ever spec'd view if I hadn't started using story
I love that story runner.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users