summaryrefslogtreecommitdiff
path: root/features/step_definitions
diff options
context:
space:
mode:
Diffstat (limited to 'features/step_definitions')
-rw-r--r--features/step_definitions/mastermind.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/features/step_definitions/mastermind.rb b/features/step_definitions/mastermind.rb
index b7f7c86..f07c541 100644
--- a/features/step_definitions/mastermind.rb
+++ b/features/step_definitions/mastermind.rb
@@ -2,19 +2,23 @@
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)
+ @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