class MongoMapperTest::MachineWithNonColumnStateAttributeDefinedTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/integrations/mongo_mapper_test.rb, line 389 def setup @model = new_model do attr_accessor :status end @machine = StateMachine::Machine.new(@model, :status, :initial => :parked) @machine.other_states(:idling) @record = @model.new end
test_should_raise_exception_for_predicate_if_invalid_state_specified()
click to toggle source
# File test/unit/integrations/mongo_mapper_test.rb, line 407 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/mongo_mapper_test.rb, line 399 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/mongo_mapper_test.rb, line 403 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/mongo_mapper_test.rb, line 411 def test_should_set_initial_state_on_created_object assert_equal 'parked', @record.status end