class StateWithIntegerValueTest

Public Instance Methods

setup() click to toggle source
# File test/unit/state_test.rb, line 213
def setup
  @klass = Class.new
  @machine = StateMachine::Machine.new(@klass)
  @machine.states << @state = StateMachine::State.new(@machine, :parked, :value => 1)
end
test_should_define_predicate() click to toggle source
# File test/unit/state_test.rb, line 232
def test_should_define_predicate
  object = @klass.new
  assert object.respond_to?(:parked?)
end
test_should_include_value_in_description() click to toggle source
# File test/unit/state_test.rb, line 223
def test_should_include_value_in_description
  assert_equal 'parked (1)', @state.description
end
test_should_match_integer_value() click to toggle source
# File test/unit/state_test.rb, line 227
def test_should_match_integer_value
  assert @state.matches?(1)
  assert !@state.matches?(2)
end
test_should_use_custom_value() click to toggle source
# File test/unit/state_test.rb, line 219
def test_should_use_custom_value
  assert_equal 1, @state.value
end