Sha256: b98c5b7295c575f5bcb353bb88c3bdcd64e37411d20a8376f6154ed2c3f871d1

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

module ICU
  describe Team do
    context "a typical team" do
      before(:each) do
        @t = Team.new('Wandering Dragons')
        @t.add_member(0)
        @t.add_member('3')
        @t.add_member('  -7  ')
      end
      
      it "should have a name" do
        @t.name.should == 'Wandering Dragons'
      end
      
      it "should have some members" do
        @t.should have(3).members
        @t.include?(0).should be_true
        @t.include?(3).should be_true
        @t.include?(-7).should be_true
        @t.include?(7).should be_false
      end
      
      it "should match names ignoring case and irrelevant whitespace" do
        @t.matches('Wandering Dragons').should be_true
        @t.matches('  wandering  dragons  ').should be_true
        @t.matches('  wanderingdragons  ').should be_false
        @t.matches('Blundering Bishops').should be_false
      end
      
      it "should have a changeable name with irrelevant whitespace being trimmed" do
        @t.name = '  blue    dragons   '
        @t.name.should == 'blue dragons'
      end
      
      it "should blowup if an attempt is made to blank the name" do
        lambda { @t.name = '  ' }.should raise_error(/blank/)
      end
      
      it "should blowup if an attempt is made to add a non-number" do
        lambda { @t.add_member('  ') }.should raise_error(/number/)
      end

      it "should blow up if an attempt is made to add a duplicate number" do
        lambda { @t.add_member(3) }.should raise_error(/duplicate/)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sanichi-chess_icu-0.4.0 spec/team_spec.rb
sanichi-chess_icu-0.4.1 spec/team_spec.rb
sanichi-chess_icu-0.4.2 spec/team_spec.rb