Sha256: f703f70f7c4682361c61f49fed2dbddf02c375241681e279240f696d0673c6dc

Contents?: true

Size: 585 Bytes

Versions: 7

Compression:

Stored size: 585 Bytes

Contents

require 'spec_helper'

module EndState
  describe Action do
    subject(:action) { Action.new(object, state) }
    let(:object) { OpenStruct.new(state: nil) }
    let(:state) { :a }

    before { object.stub_chain(:class, :store_states_as_strings).and_return(false) }

    describe '#call' do
      it 'changes the state to the new state' do
        action.call
        expect(object.state).to eq :a
      end
    end

    describe '#rollback' do
      it 'changes the state to the new state' do
        action.rollback
        expect(object.state).to eq :a
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
end_state-0.10.1 spec/end_state/action_spec.rb
end_state-0.10.0 spec/end_state/action_spec.rb
end_state-0.9.0 spec/end_state/action_spec.rb
end_state-0.4.0 spec/end_state/action_spec.rb
end_state-0.3.2 spec/end_state/action_spec.rb
end_state-0.3.1 spec/end_state/action_spec.rb
end_state-0.3.0 spec/end_state/action_spec.rb