Sha256: 6bfcb8c6459699da7fc4197f07316aeec962c98e51611b90a4c1875d8d34570f

Contents?: true

Size: 769 Bytes

Versions: 9

Compression:

Stored size: 769 Bytes

Contents

require 'spec_helper'

describe FootballManager::Player do
  subject { FootballManager::Player.new(name, skill)}

  context 'valid' do
    let(:name) { 'player 1' }
    let(:skill) { '5' }

    its(:name) { should == 'player 1' }
    its(:skill) { should == 5 }
  end

  context 'invalid with no name' do
    let(:name) { nil }
    let(:skill) { '5' }

    it 'raises an error' do
      lambda { subject }.should raise_error(FootballManager::PlayerError, 'You cannot create a player with no name')
    end
  end

  context 'invalid with no skill' do
    let(:name) { 'player 1' }
    let(:skill) { nil }

    it 'raises an error' do
      lambda { subject }.should raise_error(FootballManager::PlayerError, 'You cannot create a player with no skill')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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