1) '/games/_game.rhtml should show game name' FAILED expected /The Battle for Blaze/, got "" ./spec/views/games/_game.rhtml_spec.rb:39:
def before game_1 = 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) game_1.should_receive(:name).and_return("The Battle for Blaze") game_1.should_receive(:salt_grains).and_return(5000000) game_1.should_receive(:people).and_return(5000000) game_1.should_receive(:days).and_return(nil) game_1.should_receive(:created_at).and_return("Mon Oct 01 00:02:44 -0400 2007") game_1.should_receive(:enabled).and_return(true) game_2 = mock_model(Game, :name => 'Epicbattlegrounds', :salt_grains => 30000000, :people => 20000000, :days => 100, :created_at => "Mon Sept 01 12:02:44 -0400 2007", :enabled => false) game_2.should_receive(:name).and_return("Epicbattlegrounds") game_2.should_receive(:salt_grains).and_return(30000000) game_2.should_receive(:people).and_return(20000000) game_2.should_receive(:days).and_return(100) game_2.should_receive(:created_at).and_return("Mon Sept 01 12:02:44 -0400 2007") game_2.should_receive(:enabled).and_return(false) @games = [game_1, game_2] assigns[:games] = [game_1, game_2] end it "should show game name" do response.should have_text(/The Battle for Blaze/) render :partial =>"game", :collection => @games end I think the local variable is showing up nil because my specs in the index.rhtml were failing when they were fine before and they were saying they didn't know what this game variable was. Any ideas? On 10/5/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On 10/5/07, Andrew WC Brown <[EMAIL PROTECTED]> wrote: > > I'm trying to spec out a render partial collection but I get the > following > > error > > > > 2) > > NoMethodError in '/games/_game.rhtml should show game name' > > undefined method `body' for #<#<Class:0x316580c>:0x2f1154c> > > > /Volumes/EXTERNAL/web/omenking.ca/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/have_text.rb:12:in > > `matches?' > > ./spec/views/games/_game.rhtml_spec.rb:39: > > > > def before > > 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) > > game.should_receive(:name).and_return("The Battle for Blaze") > > game.should_receive(:salt_grains).and_return(5000000) > > game.should_receive(:people).and_return(5000000) > > game.should_receive(:days).and_return(nil) > > game.should_receive(:created_at).and_return("Mon Oct 01 00:02:44 > -0400 > > 2007") > > game.should_receive(:enabled).and_return(true) > > > > > > assigns[:games] = [game] > > end > > > > it "should show game name" do > > template.should have_text(/The Battle for Blaze/) > > response.should have_text .... > > (not template.should ...) > > > render :partial =>"game", :collection => @games > > end > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users@rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users