class BranchTest

Public Instance Methods

setup() click to toggle source
# File test/unit/branch_test.rb, line 4
def setup
  @branch = StateMachine::Branch.new(:from => :parked, :to => :idling)
end
test_should_have_a_state_requirement() click to toggle source
# File test/unit/branch_test.rb, line 20
def test_should_have_a_state_requirement
  assert_equal 1, @branch.state_requirements.length
end
test_should_not_have_an_if_condition() click to toggle source
# File test/unit/branch_test.rb, line 12
def test_should_not_have_an_if_condition
  assert_nil @branch.if_condition
end
test_should_not_have_an_unless_condition() click to toggle source
# File test/unit/branch_test.rb, line 16
def test_should_not_have_an_unless_condition
  assert_nil @branch.unless_condition
end
test_should_not_raise_exception_if_implicit_option_specified() click to toggle source
# File test/unit/branch_test.rb, line 8
def test_should_not_raise_exception_if_implicit_option_specified
  assert_nothing_raised { StateMachine::Branch.new(:invalid => :valid) }
end
test_should_raise_an_exception_if_invalid_match_option_specified() click to toggle source
# File test/unit/branch_test.rb, line 24
def test_should_raise_an_exception_if_invalid_match_option_specified
  exception = assert_raise(ArgumentError) { @branch.match(Object.new, :invalid => true) }
  assert_equal 'Invalid key(s): invalid', exception.message
end