Re: [rspec-users] Easy AR association stubbing

2007-10-26 Thread Matthew Heidemann
try: it "should find the item requested" do @current_company.items.should_receive(:find).with("1").and_return(@item) do_get end -Matt ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Easy AR association stubbing

2007-10-10 Thread Matthew Heidemann
you no longer have @players try assigns[:players].should eql(@game.players) On 10/8/07, Andrew WC Brown <[EMAIL PROTECTED]> wrote: > Here's my old association: > > @game = mock_game(:to_param => "1") > Game.stub!(:find).and_return(@game) > @players = mock('player_proxy') > @player

[rspec-users] Easy AR association stubbing

2007-10-04 Thread Matthew Heidemann
I've added a method to the mock class that makes it pretty easy to stub associations in rails. I've been using it for awhile and it seems to cut down on a lot of setup code for the controller and model specs that use associations. #before @person = mock_model(Person) posts = mock('post_proxy') pos