-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathgame_spec.rb
More file actions
69 lines (57 loc) · 2.1 KB
/
Copy pathgame_spec.rb
File metadata and controls
69 lines (57 loc) · 2.1 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require 'game'
describe Game do
let(:computer_scissors) { Game.new(2) }
let(:computer_rock) { Game.new(0) }
let(:computer_paper) { Game.new(1) }
describe '#rock' do
context 'computer move is paper' do
it 'returns a losing message' do
expect(computer_paper.rock).to eq "Sorry, you lose! You picked rock and the computer picked paper."
end
end
context 'computer move is rock' do
it 'returns a drawing message' do
expect(computer_rock.rock).to eq "It's a draw! You picked rock and so did the computer."
end
end
context 'computer move is scissors' do
it 'returns a winning message' do
expect(computer_scissors.rock).to eq "Congratulations, you won! You picked rock and the computer picked scissors."
end
end
end
describe '#paper' do
context 'computer move is paper' do
it 'returns a drawing message' do
expect(computer_paper.paper).to eq "It's a draw! You picked paper and so did the computer."
end
end
context 'computer move is rock' do
it 'returns a winning message' do
expect(computer_rock.paper).to eq "Congratulations, you won! You picked paper and the computer picked rock."
end
end
context 'computer move is scissors' do
it 'returns a losing message' do
expect(computer_scissors.paper).to eq "Sorry, you lose! You picked paper and the computer picked scissors."
end
end
end
describe '#scissors' do
context 'computer move is paper' do
it 'returns a winning message' do
expect(computer_paper.scissors).to eq "Congratulations, you won! You picked scissors and the computer picked paper."
end
end
context 'computer move is rock' do
it 'returns a losing message' do
expect(computer_rock.scissors).to eq "Sorry, you lose! You picked scissors and the computer picked rock."
end
end
context 'computer move is scissors' do
it 'returns a drawing message' do
expect(computer_scissors.scissors).to eq "It's a draw! You picked scissors and so did the computer."
end
end
end
end