class StateWithNilValueTest

Public Instance Methods

setup() click to toggle source
# File test/unit/state_test.rb, line 158
def setup
  @klass = Class.new
  @machine = StateMachine::Machine.new(@klass)
  @machine.states << @state = StateMachine::State.new(@machine, :parked, :value => nil)
end
test_should_define_predicate() click to toggle source
# File test/unit/state_test.rb, line 180
def test_should_define_predicate
  object = @klass.new
  assert object.respond_to?(:parked?)
end
test_should_have_a_description() click to toggle source
# File test/unit/state_test.rb, line 176
def test_should_have_a_description
  assert_equal 'parked (nil)', @state.description
end
test_should_have_a_name() click to toggle source
# File test/unit/state_test.rb, line 164
def test_should_have_a_name
  assert_equal :parked, @state.name
end
test_should_have_a_nil_value() click to toggle source
# File test/unit/state_test.rb, line 168
def test_should_have_a_nil_value
  assert_nil @state.value
end
test_should_match_nil_values() click to toggle source
# File test/unit/state_test.rb, line 172
def test_should_match_nil_values
  assert @state.matches?(nil)
end