Sha256: c3e299dab2af027cb5ccbd1665e9eb4fea24e17cd8a4535ef20420374d4f7742

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe FootballManager::Team do
  subject { FootballManager::Team.new}

  context 'without any players' do
    its(:size) { should == 0 }

    its(:points) { should == 0 }

    its(:empty?) { should be_true }

    its(:players) { should == [] }
  end

  context 'a player is added' do
    let(:player_1) { double('player 1', :skill => 5) }

    before(:each) do
      subject << player_1
    end

    its(:size) { should == 1 }

    its(:points) { should == 5 }

    its(:empty?) { should be_false }

    its(:players) { should == [player_1] }
  end

  context '2 players are added' do
    let(:player_A) { double('player A', :name => 'player A', :skill => 5) }
    let(:player_B) { double('player B', :name => 'player B', :skill => 3) }

    before(:each) do
      subject << player_B
      subject << player_A
    end

    its(:size) { should == 2 }

    its(:points) { should == 8 }

    its(:players) { should == [player_B, player_A] }

    its(:players_ordered_by_name) { should == [player_A, player_B] }
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

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