class BranchWithDifferentRequirementsTest

Public Instance Methods

setup() click to toggle source
# File test/unit/branch_test.rb, line 430
def setup
  @object = Object.new
  @branch = StateMachine::Branch.new(:from => :parked, :to => :idling, :on => :ignite)
end
test_should_be_nil_if_unmatched() click to toggle source
# File test/unit/branch_test.rb, line 455
def test_should_be_nil_if_unmatched
  assert_nil @branch.match(@object, :from => :parked, :to => :idling, :on => :park)
end
test_should_include_all_known_states() click to toggle source
# File test/unit/branch_test.rb, line 459
def test_should_include_all_known_states
  assert_equal [:parked, :idling], @branch.known_states
end
test_should_match_empty_query() click to toggle source
# File test/unit/branch_test.rb, line 435
def test_should_match_empty_query
  assert @branch.matches?(@object)
end
test_should_match_if_all_requirements_match() click to toggle source
# File test/unit/branch_test.rb, line 439
def test_should_match_if_all_requirements_match
  assert @branch.matches?(@object, :from => :parked, :to => :idling, :on => :ignite)
end
test_should_not_duplicate_known_statse() click to toggle source
# File test/unit/branch_test.rb, line 463
def test_should_not_duplicate_known_statse
  branch = StateMachine::Branch.new(:except_from => :idling, :to => :idling, :on => :ignite)
  assert_equal [:idling], branch.known_states
end
test_should_not_match_if_from_not_included() click to toggle source
# File test/unit/branch_test.rb, line 443
def test_should_not_match_if_from_not_included
  assert !@branch.matches?(@object, :from => :idling)
end
test_should_not_match_if_on_not_included() click to toggle source
# File test/unit/branch_test.rb, line 451
def test_should_not_match_if_on_not_included
  assert !@branch.matches?(@object, :on => :park)
end
test_should_not_match_if_to_not_included() click to toggle source
# File test/unit/branch_test.rb, line 447
def test_should_not_match_if_to_not_included
  assert !@branch.matches?(@object, :to => :parked)
end