blob: f07c54134c0213ae0fdd36e4e264eab5e5207830 (
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
|
# mastermind.rb
Given /^I am not yet playing$/ do
end
When /^I start a new game$/ do
@messenger = StringIO.new
game =Mastermind::Game.new(@messenger)
game.start
end
Then /^the game should say "(.$)"$/ do |message|
@messenger.string.split("\n").should include(message)
end
Given /^the secret code is (. . . .)$/ do |code|
@messenger = StringIO.new
@game = Mastermind::Game.new(@messenger)
@game.start(code.split)
end
When /^I guess (. . . .)$/ do |code|
@game.guess(code.split)
end
Then /^the mark should be (.*)$/ do |mark|
@messenger.string.split("\n").should include(mark)
end
|