class StateWithNameTest

Public Instance Methods

setup() click to toggle source
# File test/unit/state_test.rb, line 121
def setup
  @klass = Class.new
  @machine = StateMachine::Machine.new(@klass)
  @machine.states << @state = StateMachine::State.new(@machine, :parked)
end
test_should_define_predicate() click to toggle source
# File test/unit/state_test.rb, line 152
def test_should_define_predicate
  assert @klass.new.respond_to?(:parked?)
end
test_should_have_a_human_name() click to toggle source
# File test/unit/state_test.rb, line 135
def test_should_have_a_human_name
  assert_equal 'parked', @state.human_name
end
test_should_have_a_name() click to toggle source
# File test/unit/state_test.rb, line 127
def test_should_have_a_name
  assert_equal :parked, @state.name
end
test_should_have_a_qualified_name() click to toggle source
# File test/unit/state_test.rb, line 131
def test_should_have_a_qualified_name
  assert_equal :parked, @state.name
end
test_should_match_stringified_name() click to toggle source
# File test/unit/state_test.rb, line 143
def test_should_match_stringified_name
  assert @state.matches?('parked')
  assert !@state.matches?('idling')
end
test_should_not_include_value_in_description() click to toggle source
# File test/unit/state_test.rb, line 148
def test_should_not_include_value_in_description
  assert_equal 'parked', @state.description
end
test_should_use_stringify_the_name_as_the_value() click to toggle source
# File test/unit/state_test.rb, line 139
def test_should_use_stringify_the_name_as_the_value
  assert_equal 'parked', @state.value
end