blob: 2fe44501fdb6616929908b627a8e793117461836 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
require 'rspec'
require 'rspec-fakes'
require_relative '../player'
describe Player do
let(:sut) { Player.new }
let(:warrior) { fake }
context "when there is no obstacle" do
let(:feeling) { fake }
before :each do
warrior.stub(:feel).and_return(feeling)
feeling.stub(:empty?).and_return(true)
end
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
|