Skip to content

Commit

Permalink
Only support official Mongoid 2.0.0 release and up (no more RC support)
Browse files Browse the repository at this point in the history
  • Loading branch information
obrie committed Mar 31, 2011
1 parent 225e8dd commit c9e3f26
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rdoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
== master

* Only support official Mongoid 2.0.0 release and up (no more RC support)
* Fix attributes getting initialized more than once if different state machines use the same attribute
* Only initialize states if state is blank and blank is not a valid state
* Fix instance / class helpers failing when used with certain libraries (such as Thin)
Expand Down
17 changes: 12 additions & 5 deletions test/unit/integrations/mongoid_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def test_should_use_save_as_action
assert_equal :save, @machine.action
end

def test_should_not_have_any_before_callbacks
assert_equal 0, @machine.callbacks[:before].size
def test_should_create_notifier_before_callback
assert_equal 1, @machine.callbacks[:before].size
end

def test_should_not_have_any_after_callbacks
assert_equal 0, @machine.callbacks[:after].size
def test_should_create_notifier_after_callback
assert_equal 1, @machine.callbacks[:after].size
end
end

Expand Down Expand Up @@ -1349,9 +1349,15 @@ def setup

MongoidTest.const_set('Foo', @model)

@subclass = Class.new(@model)
@subclass = Class.new(@model) do
def self.name
'MongoidTest::SubFoo'
end
end
@subclass_machine = @subclass.state_machine(:state) {}
@subclass_machine.state :parked, :idling, :first_gear

MongoidTest.const_set('SubFoo', @subclass)
end

def test_should_only_include_records_with_subclass_states_in_with_scope
Expand All @@ -1370,6 +1376,7 @@ def test_should_only_include_records_without_subclass_states_in_without_scope
end

def teardown
MongoidTest.send(:remove_const, 'SubFoo')
MongoidTest.send(:remove_const, 'Foo')
end
end
Expand Down

0 comments on commit c9e3f26

Please sign in to comment.