class StateWithLambdaValueTest

Public Instance Methods

setup() click to toggle source
# File test/unit/state_test.rb, line 239
def setup
  @klass = Class.new
  @args = nil
  @machine = StateMachine::Machine.new(@klass)
  @value = lambda {|*args| @args = args; :parked}
  @machine.states << @state = StateMachine::State.new(@machine, :parked, :value => @value)
end
test_should_allow_access_to_original_value() click to toggle source
# File test/unit/state_test.rb, line 251
def test_should_allow_access_to_original_value
  assert_equal @value, @state.value(false)
end
test_should_define_predicate() click to toggle source
# File test/unit/state_test.rb, line 264
def test_should_define_predicate
  object = @klass.new
  assert object.respond_to?(:parked?)
end
test_should_include_masked_value_in_description() click to toggle source
# File test/unit/state_test.rb, line 255
def test_should_include_masked_value_in_description
  assert_equal 'parked (*)', @state.description
end
test_should_match_evaluated_value() click to toggle source
# File test/unit/state_test.rb, line 269
def test_should_match_evaluated_value
  assert @state.matches?(:parked)
end
test_should_not_pass_in_any_arguments() click to toggle source
# File test/unit/state_test.rb, line 259
def test_should_not_pass_in_any_arguments
  @state.value
  assert_equal [], @args
end
test_should_use_evaluated_value_by_default() click to toggle source
# File test/unit/state_test.rb, line 247
def test_should_use_evaluated_value_by_default
  assert_equal :parked, @state.value
end