class BranchWithFromRequirementTest

Public Instance Methods

setup() click to toggle source
# File test/unit/branch_test.rb, line 66
def setup
  @object = Object.new
  @branch = StateMachine::Branch.new(:from => :parked)
end
test_should_be_included_in_known_states() click to toggle source
# File test/unit/branch_test.rb, line 99
def test_should_be_included_in_known_states
  assert_equal [:parked], @branch.known_states
end
test_should_ignore_on() click to toggle source
# File test/unit/branch_test.rb, line 95
def test_should_ignore_on
  assert @branch.matches?(@object, :from => :parked, :on => :ignite)
end
test_should_ignore_to() click to toggle source
# File test/unit/branch_test.rb, line 91
def test_should_ignore_to
  assert @branch.matches?(@object, :from => :parked, :to => :idling)
end
test_should_include_requirement_in_match() click to toggle source
# File test/unit/branch_test.rb, line 103
def test_should_include_requirement_in_match
  match = @branch.match(@object, :from => :parked)
  assert_equal @branch.state_requirements.first[:from], match[:from]
end
test_should_match_if_included() click to toggle source
# File test/unit/branch_test.rb, line 79
def test_should_match_if_included
  assert @branch.matches?(@object, :from => :parked)
end
test_should_match_if_not_specified() click to toggle source
# File test/unit/branch_test.rb, line 75
def test_should_match_if_not_specified
  assert @branch.matches?(@object, :to => :idling)
end
test_should_not_match_if_nil() click to toggle source
# File test/unit/branch_test.rb, line 87
def test_should_not_match_if_nil
  assert !@branch.matches?(@object, :from => nil)
end
test_should_not_match_if_not_included() click to toggle source
# File test/unit/branch_test.rb, line 83
def test_should_not_match_if_not_included
  assert !@branch.matches?(@object, :from => :idling)
end
test_should_use_a_whitelist_matcher() click to toggle source
# File test/unit/branch_test.rb, line 71
def test_should_use_a_whitelist_matcher
  assert_instance_of StateMachine::WhitelistMatcher, @branch.state_requirements.first[:from]
end