Sha256: 59794fa4d39da55b28ebd06d90644604c28d15c8800632590c34e50884be049c

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe FootballManager::TeamSheetCreator do
  subject { FootballManager::TeamSheetCreator }

  describe 'create_team_sheet' do
    let(:player_1)  { double('player 1', :name => 'player 1', :skill => 1) }
    let(:player_2)  { double('player 2', :name => 'player 2', :skill => 1) }
    let(:team_1)    { double( 'team 1',
                              :size => 1,
                              :points => 5,
                              :players_ordered_by_name => [player_1]) }
    let(:team_2)    { double( 'team 2',
                              :size => 1,
                              :points => 5,
                              :players_ordered_by_name => [player_2]) }


    it 'asks each team for their size' do
      team_1.should_receive(:size).once
      team_2.should_receive(:size).once
      subject.create_team_sheet([team_1, team_2])
    end

    it 'asks each team for their points' do
      team_1.should_receive(:points).once
      team_2.should_receive(:points).once
      subject.create_team_sheet([team_1, team_2])
    end

    it 'outputs the team size in the teamsheet' do
      $stdout.should_receive(:puts).with("Team A has 1 player and 5 points")
      $stdout.should_receive(:puts).with("player 1")
      $stdout.should_receive(:puts).with("Team B has 1 player and 5 points")
      $stdout.should_receive(:puts).with("player 2")
      subject.create_team_sheet([team_1, team_2])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
football-manager-0.1.6 spec/football-manager/team_sheet_creator_spec.rb
football-manager-0.1.5 spec/football-manager/team_sheet_creator_spec.rb
football-manager-0.1.4 spec/football-manager/team_sheet_creator_spec.rb