From aad4750c4a8faeb30f2c0e4b42f099e2bbf7ba55 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 26 Apr 2013 18:07:13 -0600 Subject: complete level 3 --- rubywarrior/ultimate-beginner/spec/player_spec.rb | 43 +++++++++++++++++++---- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'rubywarrior/ultimate-beginner/spec/player_spec.rb') diff --git a/rubywarrior/ultimate-beginner/spec/player_spec.rb b/rubywarrior/ultimate-beginner/spec/player_spec.rb index 2fe4450..32ee857 100644 --- a/rubywarrior/ultimate-beginner/spec/player_spec.rb +++ b/rubywarrior/ultimate-beginner/spec/player_spec.rb @@ -6,7 +6,6 @@ describe Player do let(:sut) { Player.new } let(:warrior) { fake } - context "when there is no obstacle" do let(:feeling) { fake } @@ -15,10 +14,24 @@ describe Player do feeling.stub(:empty?).and_return(true) end - before { sut.play_turn(warrior) } + context "when your health is full" do + before { warrior.stub(:health).and_return(20) } + + before { sut.play_turn(warrior) } - it "should walk" do - warrior.should have_received(:walk!) + it "should walk" do + warrior.should have_received(:walk!) + end + end + + context "when your health is low" do + before { warrior.stub(:health).and_return(19) } + + before { sut.play_turn(warrior) } + + it "should rest" do + warrior.should have_received(:rest!) + end end end @@ -30,10 +43,26 @@ describe Player do feeling.stub(:empty?).and_return(false) end - before { sut.play_turn(warrior) } + context "when your health is full" do + before :each do + warrior.stub(:health).and_return(20) + end + + before { sut.play_turn(warrior) } + + it "should attack the sludge" do + warrior.should have_received(:attack!) + end + end - it "should attack the sludge" do - warrior.should have_received(:attack!) + context "when your health is low" do + before :each do + warrior.stub(:health).and_return(19) + end + it "should walk backwards then rest" do + sut.play_turn(warrior) + warrior.should have_received(:walk!, :backward) + end end end end -- cgit v1.2.3