Sha256: ef79eadd63ee6c6fd3f37f708b50490e2939e964e620dafad40e9855219c19b1

Contents?: true

Size: 1.6 KB

Versions: 9

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe FootballManager::Game do
  subject { FootballManager::Game }

  describe 'pick_teams' do
    let(:player_data_reference) { double('player data reference') }
    let(:player_data) { double('player data') }
    let(:players) { double('players') }
    let(:teams) { double('teams') }
    let(:team_sheet) { double('team sheet') }

    before(:each) do
      FootballManager::IOHelper.stub(:fetch_player_data => player_data)
      FootballManager::PlayersCreator.stub(:create_players => players)
      FootballManager::TeamPicker.stub(:calculate_fair_teams => teams)
      FootballManager::TeamSheetCreator.stub(:create_team_sheet => team_sheet)
    end

    it 'tells the IOHelper to fetch the player data' do
      FootballManager::IOHelper.should_receive(:fetch_player_data).with(player_data_reference).and_return(player_data)
      subject.pick_teams(player_data_reference)
    end

    it 'tells the PlayersCreator to create the players from the input file' do
      FootballManager::PlayersCreator.should_receive(:create_players).with(player_data).and_return(players)
      subject.pick_teams(player_data_reference)
    end

    it 'tells the TeamPicker to pick the fairest teams from the available players' do
      FootballManager::TeamPicker.should_receive(:calculate_fair_teams).with(players).and_return(teams)
      subject.pick_teams(player_data_reference)
    end

    it 'tells the TeamSheetCreator to create a teamsheet from the teams' do
      FootballManager::TeamSheetCreator.should_receive(:create_team_sheet).with(teams)
      subject.pick_teams(player_data_reference)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
football-manager-1.0.1 spec/football-manager/game_spec.rb
football-manager-0.1.8 spec/football-manager/game_spec.rb
football-manager-0.1.7 spec/football-manager/game_spec.rb
football-manager-0.1.6 spec/football-manager/game_spec.rb
football-manager-0.1.5 spec/football-manager/game_spec.rb
football-manager-0.1.4 spec/football-manager/game_spec.rb
football-manager-0.1.2 spec/football-manager/game_spec.rb
football-manager-0.1.1 spec/football-manager/game_spec.rb
football-manager-0.1.0 spec/football-manager/game_spec.rb