Sha256: 7d124fb55e4d4a5a38a814a0202b5a343b393e657343bdaac391133738722731

Contents?: true

Size: 1021 Bytes

Versions: 5

Compression:

Stored size: 1021 Bytes

Contents

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

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

5 entries across 5 versions & 1 rubygems

Version Path
gamebox-0.2.1 spec/backstage_spec.rb
gamebox-0.1.1 spec/backstage_spec.rb
gamebox-0.1.0 spec/backstage_spec.rb
gamebox-0.0.9 spec/backstage_spec.rb
gamebox-0.0.8 spec/backstage_spec.rb