Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Forked from anonymous/game.rb
Created August 16, 2009 13:40
Show Gist options
  • Save dchelimsky/168629 to your computer and use it in GitHub Desktop.
Save dchelimsky/168629 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
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
subject.add_team mock('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