class BranchWithMultipleImplicitRequirementsTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/branch_test.rb, line 516 def setup @object = Object.new @branch = StateMachine::Branch.new(:parked => :idling, :idling => :first_gear, :on => :ignite) end
test_should_create_multiple_state_requirements()
click to toggle source
# File test/unit/branch_test.rb, line 521 def test_should_create_multiple_state_requirements assert_equal 2, @branch.state_requirements.length end
test_should_include_all_known_states()
click to toggle source
# File test/unit/branch_test.rb, line 557 def test_should_include_all_known_states assert_equal [:first_gear, :idling, :parked], @branch.known_states.sort_by {|state| state.to_s} end
test_should_match_if_all_options_match()
click to toggle source
# File test/unit/branch_test.rb, line 547 def test_should_match_if_all_options_match assert @branch.matches?(@object, :from => :parked, :to => :idling, :on => :ignite) assert @branch.matches?(@object, :from => :idling, :to => :first_gear, :on => :ignite) end
test_should_match_if_from_included_in_any()
click to toggle source
# File test/unit/branch_test.rb, line 529 def test_should_match_if_from_included_in_any assert @branch.matches?(@object, :from => :parked) assert @branch.matches?(@object, :from => :idling) end
test_should_match_if_to_included_in_any()
click to toggle source
# File test/unit/branch_test.rb, line 538 def test_should_match_if_to_included_in_any assert @branch.matches?(@object, :to => :idling) assert @branch.matches?(@object, :to => :first_gear) end
test_should_not_duplicate_known_statse()
click to toggle source
# File test/unit/branch_test.rb, line 561 def test_should_not_duplicate_known_statse branch = StateMachine::Branch.new(:parked => :idling, :first_gear => :idling) assert_equal [:first_gear, :idling, :parked], branch.known_states.sort_by {|state| state.to_s} end
test_should_not_match_event_as_state_requirement()
click to toggle source
# File test/unit/branch_test.rb, line 525 def test_should_not_match_event_as_state_requirement assert !@branch.matches?(@object, :from => :on, :to => :ignite) end
test_should_not_match_if_any_options_do_not_match()
click to toggle source
# File test/unit/branch_test.rb, line 552 def test_should_not_match_if_any_options_do_not_match assert !@branch.matches?(@object, :from => :parked, :to => :idling, :on => :park) assert !@branch.matches?(@object, :from => :parked, :to => :first_gear, :on => :park) end
test_should_not_match_if_from_not_included_in_any()
click to toggle source
# File test/unit/branch_test.rb, line 534 def test_should_not_match_if_from_not_included_in_any assert !@branch.matches?(@object, :from => :first_gear) end
test_should_not_match_if_to_not_included_in_any()
click to toggle source
# File test/unit/branch_test.rb, line 543 def test_should_not_match_if_to_not_included_in_any assert !@branch.matches?(@object, :to => :parked) end