Sha256: 5c7592a4539372a79941e7ad9ef4149db3712bd72fa84276ef9cec962aaa1da5

Contents?: true

Size: 1002 Bytes

Versions: 3

Compression:

Stored size: 1002 Bytes

Contents

require File.join(File.dirname(__FILE__),'helper')


describe 'A new backstage' do

  before do
    @backstage = Backstage.new
  end

  it 'should construct' do
    @backstage.should_not be_nil
  end

  it 'should return nil if not found' do
    @backstage.get(:foo).should be_nil
  end

  it 'should return the value if found' do
    @backstage.set(:foo,:foo_val).should == :foo_val
    @backstage.get(:foo).should == :foo_val
  end

  it 'should replace with new values' do
    @backstage.set(:foo,:foo_val).should == :foo_val
    @backstage.get(:foo).should == :foo_val

    @backstage.set(:foo,:other_val).should == :other_val
    @backstage.get(:foo).should == :other_val
  end

  it 'should properly offer bracket notation' do
    @backstage[:foo] = :val
    @backstage[:foo].should == :val
  end

  it 'should raise if an Actor strolls off backstage' do
    class Foo < Actor
      def initialize;end
    end
    foo = Foo.new

    lambda{ @backstage[:foo] = foo }.should raise_error
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gamebox-0.3.4 spec/backstage_spec.rb
gamebox-0.3.3 spec/backstage_spec.rb
gamebox-0.3.2 spec/backstage_spec.rb