dchelimsky (owner)

Fork Of

gist: 168572 by anonymous

Revisions

gist: 168629 Download_button fork
public
Public Clone URL: git://gist.github.com/168629.git
Embed All Files: show embed
game.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
 
game_spec.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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