Sha256: 1153df8a4201daadec0abb04bd250ce74fdb16c84ee85929fc9442d95ef5ba63

Contents?: true

Size: 595 Bytes

Versions: 8

Compression:

Stored size: 595 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 { allow(object).to receive_message_chain(:class, store_states_as_strings: 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

8 entries across 8 versions & 1 rubygems

Version Path
end_state-1.1.2 spec/end_state/action_spec.rb
end_state-1.1.1 spec/end_state/action_spec.rb
end_state-1.1.0 spec/end_state/action_spec.rb
end_state-1.0.2 spec/end_state/action_spec.rb
end_state-1.0.1 spec/end_state/action_spec.rb
end_state-1.0.0 spec/end_state/action_spec.rb
end_state-0.12.0 spec/end_state/action_spec.rb
end_state-0.11.0 spec/end_state/action_spec.rb