Sha256: 2d1d1b9b3252d2d959597817d362e89a6d79edb655a6280562712805cc688663

Contents?: true

Size: 845 Bytes

Versions: 14

Compression:

Stored size: 845 Bytes

Contents

require_relative '../../test_helper'

class AttributeTransitionCollectionWithAroundCallbackAfterYieldErrorTest < StateMachinesTest
  def setup
    @klass = Class.new

    @machine = StateMachines::Machine.new(@klass, initial: :parked, action: :save)
    @machine.state :idling
    @machine.event :ignite

    @machine.around_transition { |block| block.call; fail ArgumentError }

    @object = @klass.new
    @object.state_event = 'ignite'

    @transitions = StateMachines::AttributeTransitionCollection.new([
      StateMachines::Transition.new(@object, @machine, :ignite, :parked, :idling)
    ])
    begin
      ; @transitions.perform
    rescue
    end
  end

  def test_should_clear_event
    assert_nil @object.state_event
  end

  def test_should_not_write_event_transition
    assert_nil @object.send(:state_event_transition)
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
state_machines-0.5.0 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
state_machines-0.4.0 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
state_machines-0.3.0 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
state_machines-0.2.2 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
state_machines-0.2.1 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
state_machines-0.2.0 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
state_machines-0.1.4 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
state_machines-0.1.3 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
state_machines-0.1.2 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
state_machines-0.1.1 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb
state_machines-0.1.0 test/unit/transition_collection/attribute_transition_collection_with_around_callback_after_yield_error_test.rb