class MongoidTest::MachineWithDefaultScope

Public Instance Methods

setup() click to toggle source
# File test/unit/integrations/mongoid_test.rb, line 1483
def setup
  @model = new_model
  @machine = StateMachine::Machine.new(@model, :initial => :parked)
  @machine.state :idling
  
  @model.class_eval do
    default_scope with_state(:parked, :idling)
  end
end
test_should_set_initial_state_on_created_object() click to toggle source
# File test/unit/integrations/mongoid_test.rb, line 1493
def test_should_set_initial_state_on_created_object
  object = @model.new
  assert_equal 'parked', object.state
end