Sha256: 38ea329d3415395cb2ffeca88a3437e741023afb9ec232ecf2a22baaf38bc763

Contents?: true

Size: 1.16 KB

Versions: 14

Compression:

Stored size: 1.16 KB

Contents

require_relative '../../test_helper'
require_relative 'transition_collection_with_action_hook_base_test.rb'

class TransitionCollectionWithActionHookWithNilActionTest < TransitionCollectionWithActionHookBaseTest
  def setup
    super

    @machine = StateMachines::Machine.new(@klass, :status, initial: :first_gear)
    @machine.state :second_gear
    @machine.event :shift_up

    @result = StateMachines::TransitionCollection.new([@transition, StateMachines::Transition.new(@object, @machine, :shift_up, :first_gear, :second_gear)]).perform
  end

  def test_should_succeed
    assert_equal true, @result
  end

  def test_should_run_action
    assert @object.saved
  end

  def test_should_have_already_persisted_when_running_action
    assert_equal 'idling', @object.state_on_save
  end

  def test_should_not_have_event_during_action
    assert_nil @object.state_event_on_save
  end

  def test_should_not_write_event
    assert_nil @object.state_event
  end

  def test_should_not_have_event_transition_during_save
    assert_nil @object.state_event_transition_on_save
  end

  def test_should_not_write_event_attribute
    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/transition_collection_with_action_hook_with_nil_action_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
state_machines-0.4.0 test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
state_machines-0.3.0 test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
state_machines-0.2.2 test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
state_machines-0.2.1 test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
state_machines-0.2.0 test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
state_machines-0.1.4 test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
state_machines-0.1.3 test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
state_machines-0.1.2 test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
state_machines-0.1.1 test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb
state_machines-0.1.0 test/unit/transition_collection/transition_collection_with_action_hook_with_nil_action_test.rb