diff options
| author | mo khan <mo@mokhan.ca> | 2009-05-27 09:04:07 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2009-05-27 09:04:07 -0600 |
| commit | 4b8f713fc36eadf7f974d80c72ed22be413efcbe (patch) | |
| tree | 8c94415ede4525b6a4980905caf2efe8fd52c0f7 /spec/mastermind/game_spec.rb | |
| parent | da73fdb2d793f4190bd89fd210b2b6188c62e2d3 (diff) | |
testing git commit from gvim
Diffstat (limited to 'spec/mastermind/game_spec.rb')
| -rw-r--r-- | spec/mastermind/game_spec.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/mastermind/game_spec.rb b/spec/mastermind/game_spec.rb index dd50e48..22c1716 100644 --- a/spec/mastermind/game_spec.rb +++ b/spec/mastermind/game_spec.rb @@ -10,11 +10,31 @@ module Mastermind end it "should send a welcome message" do @messenger.should_receive(:puts).with("Welcome to Mastermind!") - @game.start + @game.start(%w[r c g y]) end it "should prompt for the first guess" do @messenger.should_receive(:puts).with("Enter guess:") - @game.start + @game.start(%w[r c g y]) + end + end + context "marking a guess" do + context "with all 4 colors correct in the correct places" do + it "should mark the guess with bbbb" do + messenger = mock("messenger").as_null_object + game = Game.new(messenger) + game.start(%w[r g y c]) + messenger.should_receive(:puts).with("bbbb") + game.guess(%w[r g y c]) + end + end + context "with all 4 colors correct and 2 in the correct places" do + it "should mark the guess with bbww" do + messenger = mock("messenger").as_null_object + game = Game.new(messenger) + game.start(%w[r g y c]) + messenger.should_receive(:puts).with("bbww") + game.guess(%w[r g c y]) + end end end end |
