Displaying 1 result from an estimated 1 matches for "create_gam".
Did you mean:
create_game
2006 Apr 11
0
Trying to come up with a nice DSL, but having some problems
...ongs_to :rescued, :foreign_key => ''rescued_id'', :class_name => ''Player''
end
class Player
belongs_to :game
def rescue_player(p)
game.rescue_player p
end
end
So what I want to do is be able to create a game object and do
something like this:
g = create_game # factory method in test_helper that just creates a
new random game
g.players.first.rescue_player g.players.last
assert_equal g.players.last, g.turns.last.rescued
Now if I just do that, the data gets saved in the database, but the
assert fails. This is because g != g.players.last.game. I can do...