class MachineTest

Public Instance Methods

test_should_evaluate_a_block_during_initialization() click to toggle source
# File test/unit/machine_test.rb, line 927
def test_should_evaluate_a_block_during_initialization
  called = true
  StateMachine::Machine.new(Class.new) do
    called = respond_to?(:event)
  end
  
  assert called
end
test_should_not_raise_exception_if_custom_messages_specified() click to toggle source
# File test/unit/machine_test.rb, line 923
def test_should_not_raise_exception_if_custom_messages_specified
  assert_nothing_raised {StateMachine::Machine.new(Class.new, :messages => {:invalid_transition => 'custom'})}
end
test_should_provide_matcher_helpers_during_initialization() click to toggle source
# File test/unit/machine_test.rb, line 936
def test_should_provide_matcher_helpers_during_initialization
  matchers = []
  
  StateMachine::Machine.new(Class.new) do
    matchers = [all, any, same]
  end
  
  assert_equal [StateMachine::AllMatcher.instance, StateMachine::AllMatcher.instance, StateMachine::LoopbackMatcher.instance], matchers
end
test_should_raise_exception_if_invalid_option_specified() click to toggle source
# File test/unit/machine_test.rb, line 919
def test_should_raise_exception_if_invalid_option_specified
  assert_raise(ArgumentError) {StateMachine::Machine.new(Class.new, :invalid => true)}
end