Skip to content

Instantly share code, notes, and snippets.

@searls
Created May 24, 2011 03:05
Show Gist options
  • Save searls/988081 to your computer and use it in GitHub Desktop.
Save searls/988081 to your computer and use it in GitHub Desktop.
Dearest friend, Mike Busch -- example taken from the RSpec Book: http://media.pragprog.com/titles/achbd/code/cb/42/spec/codebreaker/game_spec.rb
#compare to RSpec Book: http://media.pragprog.com/titles/achbd/code/cb/42/spec/codebreaker/game_spec.rb
require 'spec_helper'
module Codebreaker
describe Codebreaker::Game do
let(:output) { gimme(IO) }
let(:game) { Game.new(output) }
describe '#start' do
before do
game.start('1234')
end
it 'sends a welcome message' do
#the `!` is necessary b/c puts is a private method on IO
verify!(output).puts('Welcome to Codebreaker!')
end
it 'prompts for the first guess' do
verify!(output).puts('Enter guess:')
end
end
# ... #
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment