I writing a spec that returns the count of how many players in a game:
it "should how many players in a link to all players" do
render :partial =>"games/game", :object => @game
response.should have_tag('a',"(2) Players")
end
I'm not sure how to do the mock model, I think it would be done two ways but
unsure of the syntax:
1: add players in
@game = mock_model(Game,
:name => 'The Battle for Blaze',
:salt_grains => '5000000',
:people => '5000000',
:days => nil,
:created_at => "Mon Oct 01 00:02:44 -0400 2007",
:enabled => true,
:players => {
})
2: assign them to players
@game = mock_model(Game,
:name => 'The Battle for Blaze',
:salt_grains => '5000000',
:people => '5000000',
:days => nil,
:created_at => "Mon Oct 01 00:02:44 -0400 2007",
:enabled => true)
player_1 = mock_model(Player, :salt_grains => '500')
player_2 = mock_model(Player, :salt_grains => '900')
@game.players = [ player_1, player_2 ]
How do I write this? I would need an example
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users