Skip to content

Instantly share code, notes, and snippets.

Created August 16, 2009 05:50
Show Gist options
  • Save anonymous/168572 to your computer and use it in GitHub Desktop.
Save anonymous/168572 to your computer and use it in GitHub Desktop.
class Game
attr_reader :teams
def initialize
@teams = Array.new
end
def started?
false
end
def innings
Array.new
end
def add_team team
@teams << team
end
end
require File.expand_path('spec_helper', File.dirname(__FILE__))
require 'game'
describe Game do
before :each do
@game = Game.new
end
context "before it is started", @game do
it { should_not be_started }
it { should have_no_teams }
it { should have_no_innings }
context "when a team is added" do
before :each do
team = mock('Team')
@game.add_team team
end
it { should have(1).teams }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment