class TransitionCollectionWithSkippedAfterCallbacksTest

Public Instance Methods

setup() click to toggle source
# File test/unit/transition_collection_test.rb, line 1112
def setup
  @klass = Class.new
  
  @machine = StateMachine::Machine.new(@klass, :initial => :parked)
  @machine.state :idling
  @machine.event :ignite
  @machine.after_transition {@ran_after = true}
  @machine.around_transition {|block| @ran_around_before = true; block.call; @ran_around_after = true}
  
  @object = @klass.new
  
  @transitions = StateMachine::TransitionCollection.new([
    @transition = StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling)
  ], :after => false)
  @result = @transitions.perform
end
test_should_not_rerun_around_callbacks_before_yield_on_subsequent_perform() click to toggle source
# File test/unit/transition_collection_test.rb, line 1151
def test_should_not_rerun_around_callbacks_before_yield_on_subsequent_perform
  @ran_around_before = false
  StateMachine::TransitionCollection.new([@transition]).perform
  
  assert !@ran_around_before
end
test_should_not_run_after_callbacks() click to toggle source
# File test/unit/transition_collection_test.rb, line 1133
def test_should_not_run_after_callbacks
  assert !@ran_after
end
test_should_not_run_around_callbacks_after_yield() click to toggle source
# File test/unit/transition_collection_test.rb, line 1137
def test_should_not_run_around_callbacks_after_yield
  assert !@ran_around_after
end
test_should_run_after_callbacks_on_subsequent_perform() click to toggle source
# File test/unit/transition_collection_test.rb, line 1141
def test_should_run_after_callbacks_on_subsequent_perform
  StateMachine::TransitionCollection.new([@transition]).perform
  assert @ran_after
end
test_should_run_around_callbacks_after_yield_on_subsequent_perform() click to toggle source
# File test/unit/transition_collection_test.rb, line 1146
def test_should_run_around_callbacks_after_yield_on_subsequent_perform
  StateMachine::TransitionCollection.new([@transition]).perform
  assert @ran_around_after
end
test_should_succeed() click to toggle source
# File test/unit/transition_collection_test.rb, line 1129
def test_should_succeed
  assert_equal true, @result
end