test/functional/test_callbacks.rb in tpitale-mongo_mapper-0.6.9 vs test/functional/test_callbacks.rb in tpitale-mongo_mapper-0.6.10
- old
+ new
@@ -1,14 +1,11 @@
require 'test_helper'
class CallbacksTest < Test::Unit::TestCase
context "Defining and running callbacks" do
setup do
- @document = Class.new do
- include MongoMapper::Document
- set_collection_name 'test'
-
+ @document = Doc do
key :name, String
[ :before_validation_on_create, :before_validation_on_update,
:before_validation, :after_validation,
:before_create, :after_create,
@@ -28,10 +25,9 @@
def clear_history
@history = nil
end
end
- @document.collection.remove
end
should "get the order right for creating documents" do
doc = @document.create(:name => 'John Nunemaker')
doc.history.should == [:before_validation, :before_validation_on_create, :after_validation, :before_save, :before_create, :after_create, :after_save]
\ No newline at end of file