-
-
Save dchelimsky/168629 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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