summaryrefslogtreecommitdiff
path: root/rubywarrior/ultimate-beginner/spec/player_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'rubywarrior/ultimate-beginner/spec/player_spec.rb')
-rw-r--r--rubywarrior/ultimate-beginner/spec/player_spec.rb43
1 files changed, 36 insertions, 7 deletions
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