class DataMapperTest::MachineWithNonColumnStateAttributeDefinedTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 429 def setup @resource = new_resource do attr_accessor :status end @machine = StateMachine::Machine.new(@resource, :status, :initial => :parked) @machine.other_states(:idling) @record = @resource.new end
test_should_raise_exception_for_predicate_if_invalid_state_specified()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 447 def test_should_raise_exception_for_predicate_if_invalid_state_specified assert_raise(IndexError) { @record.status?(:invalid) } end
test_should_return_false_for_predicate_if_does_not_match_current_value()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 439 def test_should_return_false_for_predicate_if_does_not_match_current_value assert !@record.status?(:idling) end
test_should_return_true_for_predicate_if_matches_current_value()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 443 def test_should_return_true_for_predicate_if_matches_current_value assert @record.status?(:parked) end
test_should_set_initial_state_on_created_object()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 451 def test_should_set_initial_state_on_created_object assert_equal 'parked', @record.status end