Sha256: 44cdd0e82973e030397cefe1f475985d9f9df3cc3c73d1decd054f930fd5f5fb

Contents?: true

Size: 794 Bytes

Versions: 3

Compression:

Stored size: 794 Bytes

Contents

require 'spec_helper'

describe Decorum::DecoratedState do
  let(:ds) { Decorum::DecoratedState.new(foo: "bar") }
  
  it 'assigns initialized options' do
    expect(ds.foo).to eq("bar")
  end

  context 'when forwarding messages' do
    before(:each) do
      # need to pop it open first...
      fake_shared_state = Decorum::Spec::DecoratedState::SharedStateStub.new
      ds.instance_variable_set(:@shared_state, fake_shared_state)
    end

    it 'forwards getter methods' do
      expect(ds.marker).to eq("retrieved")
    end

    it 'forwards setter methods' do
      expect(ds.send(:"marker=", 'foo')).to eq('assigned')
    end

    describe '#respond_to?' do
      it 'is false for forwarded messages' do
        expect(ds.respond_to?(:marker)).to be false
      end
    end 
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decorum-0.5.1 spec/unit/decorated_state_spec.rb
decorum-0.5.0 spec/unit/decorated_state_spec.rb
decorum-0.4.1 spec/unit/decorated_state_spec.rb