class BranchWithNoRequirementsTest

Public Instance Methods

setup() click to toggle source
# File test/unit/branch_test.rb, line 31
def setup
  @object = Object.new
  @branch = StateMachine::Branch.new
end
test_should_include_all_requirements_in_match() click to toggle source
# File test/unit/branch_test.rb, line 56
def test_should_include_all_requirements_in_match
  match = @branch.match(@object, {})
  
  assert_equal @branch.state_requirements.first[:from], match[:from]
  assert_equal @branch.state_requirements.first[:to], match[:to]
  assert_equal @branch.event_requirement, match[:on]
end
test_should_match_empty_query() click to toggle source
# File test/unit/branch_test.rb, line 48
def test_should_match_empty_query
  assert @branch.matches?(@object, {})
end
test_should_match_non_empty_query() click to toggle source
# File test/unit/branch_test.rb, line 52
def test_should_match_non_empty_query
  assert @branch.matches?(@object, :to => :idling, :from => :parked, :on => :ignite)
end
test_should_use_all_matcher_for_event_requirement() click to toggle source
# File test/unit/branch_test.rb, line 36
def test_should_use_all_matcher_for_event_requirement
  assert_equal StateMachine::AllMatcher.instance, @branch.event_requirement
end
test_should_use_all_matcher_for_from_state_requirement() click to toggle source
# File test/unit/branch_test.rb, line 40
def test_should_use_all_matcher_for_from_state_requirement
  assert_equal StateMachine::AllMatcher.instance, @branch.state_requirements.first[:from]
end
test_should_use_all_matcher_for_to_state_requirement() click to toggle source
# File test/unit/branch_test.rb, line 44
def test_should_use_all_matcher_for_to_state_requirement
  assert_equal StateMachine::AllMatcher.instance, @branch.state_requirements.first[:to]
end