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