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.rb28
1 files changed, 24 insertions, 4 deletions
diff --git a/rubywarrior/ultimate-beginner/spec/player_spec.rb b/rubywarrior/ultimate-beginner/spec/player_spec.rb
index b18d9d8..2fe4450 100644
--- a/rubywarrior/ultimate-beginner/spec/player_spec.rb
+++ b/rubywarrior/ultimate-beginner/spec/player_spec.rb
@@ -4,16 +4,36 @@ require_relative '../player'
describe Player do
let(:sut) { Player.new }
+ let(:warrior) { fake }
- context "when resting" do
- let(:warrior) { fake }
+
+ context "when there is no obstacle" do
+ let(:feeling) { fake }
before :each do
- sut.play_turn(warrior)
+ warrior.stub(:feel).and_return(feeling)
+ feeling.stub(:empty?).and_return(true)
end
- it "should walk forward" do
+ before { sut.play_turn(warrior) }
+
+ it "should walk" do
warrior.should have_received(:walk!)
end
end
+
+ context "when there is sludge in front of you" do
+ let(:feeling) { fake }
+
+ before :each do
+ warrior.stub(:feel).and_return(feeling)
+ feeling.stub(:empty?).and_return(false)
+ end
+
+ before { sut.play_turn(warrior) }
+
+ it "should attack the sludge" do
+ warrior.should have_received(:attack!)
+ end
+ end
end