summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2009-05-28 13:07:10 -0600
committermo khan <mo@mokhan.ca>2009-05-28 13:07:10 -0600
commite1afbc888054063cb471affdd2b0ff02f423b8ef (patch)
tree3a3840637e88992740bd132342deaa910c0259eb /spec
parent1b3e97664a6fe0af00cb0aef406ebba8de69f7c9 (diff)
made it up to page 88main
Diffstat (limited to 'spec')
-rw-r--r--spec/mastermind/game_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/mastermind/game_spec.rb b/spec/mastermind/game_spec.rb
index 4788aa9..dd14dc8 100644
--- a/spec/mastermind/game_spec.rb
+++ b/spec/mastermind/game_spec.rb
@@ -40,5 +40,21 @@ module Mastermind
end
end
end
+ context "with duplicates in the guess that match a peg in the code" do
+ context "by color and position" do
+ it "should add a single b to the mark" do
+ @game.start(%w[r y g c])
+ @messenger.should_receive(:puts).with("bbb")
+ @game.guess(%w[r y g g])
+ end
+ end
+ end
+ context "with three colors correct in the correct places" do
+ it "should mark the guess with bbb" do
+ @game.start(%w[r g y c])
+ @messenger.should_receive(:puts).with("bbb")
+ @game.guess(%w[r g y w])
+ end
+ end
end
end