mongo_mapper-unstable 2009.10.16 → 2009.10.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/.gitignore +3 -1
  2. data/README.rdoc +3 -0
  3. data/Rakefile +31 -65
  4. data/VERSION +1 -1
  5. data/lib/mongo_mapper/associations/base.rb +31 -4
  6. data/lib/mongo_mapper/associations/many_documents_as_proxy.rb +0 -2
  7. data/lib/mongo_mapper/associations/many_documents_proxy.rb +21 -15
  8. data/lib/mongo_mapper/associations/many_embedded_polymorphic_proxy.rb +2 -2
  9. data/lib/mongo_mapper/associations/many_embedded_proxy.rb +21 -36
  10. data/lib/mongo_mapper/associations/many_polymorphic_proxy.rb +1 -1
  11. data/lib/mongo_mapper/associations/proxy.rb +1 -0
  12. data/lib/mongo_mapper/associations.rb +114 -17
  13. data/lib/mongo_mapper/callbacks.rb +18 -0
  14. data/lib/mongo_mapper/document.rb +230 -95
  15. data/lib/mongo_mapper/dynamic_finder.rb +1 -1
  16. data/lib/mongo_mapper/embedded_document.rb +7 -3
  17. data/lib/mongo_mapper/finder_options.rb +88 -56
  18. data/lib/mongo_mapper/pagination.rb +2 -0
  19. data/lib/mongo_mapper/serialization.rb +2 -3
  20. data/lib/mongo_mapper/serializers/json_serializer.rb +1 -1
  21. data/lib/mongo_mapper/support.rb +9 -0
  22. data/lib/mongo_mapper/validations.rb +14 -42
  23. data/lib/mongo_mapper.rb +15 -13
  24. data/mongo_mapper.gemspec +13 -13
  25. data/specs.watchr +2 -2
  26. data/test/functional/associations/test_belongs_to_polymorphic_proxy.rb +5 -5
  27. data/test/functional/associations/test_belongs_to_proxy.rb +28 -30
  28. data/test/functional/associations/test_many_documents_as_proxy.rb +4 -4
  29. data/test/functional/associations/test_many_embedded_polymorphic_proxy.rb +27 -3
  30. data/test/functional/associations/test_many_embedded_proxy.rb +58 -38
  31. data/test/functional/associations/test_many_polymorphic_proxy.rb +49 -7
  32. data/test/functional/associations/test_many_proxy.rb +65 -15
  33. data/test/functional/test_associations.rb +3 -3
  34. data/test/functional/test_binary.rb +1 -1
  35. data/test/functional/test_callbacks.rb +1 -1
  36. data/test/functional/test_dirty.rb +3 -3
  37. data/test/functional/test_document.rb +178 -57
  38. data/test/functional/test_embedded_document.rb +1 -1
  39. data/test/functional/test_pagination.rb +18 -18
  40. data/test/functional/test_rails_compatibility.rb +1 -1
  41. data/test/functional/test_validations.rb +80 -27
  42. data/test/models.rb +93 -17
  43. data/test/support/{test_timing.rb → timing.rb} +1 -1
  44. data/test/test_helper.rb +8 -11
  45. data/test/unit/test_association_base.rb +23 -1
  46. data/test/unit/test_document.rb +29 -12
  47. data/test/unit/test_embedded_document.rb +13 -4
  48. data/test/unit/test_finder_options.rb +74 -58
  49. data/test/unit/test_mongomapper.rb +2 -2
  50. data/test/unit/test_pagination.rb +4 -0
  51. metadata +7 -7
@@ -12,7 +12,7 @@ class DocumentTest < Test::Unit::TestCase
12
12
  key :age, Integer
13
13
  key :date, Date
14
14
  end
15
- @document.collection.clear
15
+ @document.collection.remove
16
16
  end
17
17
 
18
18
  context "Saving a document with a custom id" do
@@ -23,7 +23,7 @@ class DocumentTest < Test::Unit::TestCase
23
23
  doc.using_custom_id?.should be_false
24
24
  end
25
25
  end
26
-
26
+
27
27
  context "Saving a document with a blank binary value" do
28
28
  setup do
29
29
  @document.key :file, Binary
@@ -40,9 +40,9 @@ class DocumentTest < Test::Unit::TestCase
40
40
  @id = Mongo::ObjectID.new.to_s
41
41
  @document.collection.insert({
42
42
  :_id => @id,
43
- :first_name => 'John',
44
- :last_name => 'Nunemaker',
45
- :age => 27,
43
+ :first_name => 'John',
44
+ :last_name => 'Nunemaker',
45
+ :age => 27,
46
46
  :favorite_color => 'red',
47
47
  :skills => ['ruby', 'rails', 'javascript', 'xhtml', 'css']
48
48
  })
@@ -57,7 +57,7 @@ class DocumentTest < Test::Unit::TestCase
57
57
  doc.skills.should == ['ruby', 'rails', 'javascript', 'xhtml', 'css']
58
58
  end
59
59
  end
60
-
60
+
61
61
  context "Document Class Methods" do
62
62
  context "Using key with type Array" do
63
63
  setup do
@@ -140,7 +140,7 @@ class DocumentTest < Test::Unit::TestCase
140
140
  doc.foo['baz'].should == 'bar'
141
141
  end
142
142
  end
143
-
143
+
144
144
  context "Using key with custom type with default" do
145
145
  setup do
146
146
  @document.key :window, WindowSize, :default => WindowSize.new(600, 480)
@@ -149,19 +149,19 @@ class DocumentTest < Test::Unit::TestCase
149
149
  should "default to default" do
150
150
  doc = @document.new
151
151
  doc.window.should == WindowSize.new(600, 480)
152
-
152
+
153
153
  end
154
-
154
+
155
155
  should "save and load from mongo" do
156
156
  doc = @document.new
157
157
  doc.save
158
-
158
+
159
159
  from_db = @document.find(doc.id)
160
160
  from_db.window.should == WindowSize.new(600, 480)
161
161
  end
162
162
  end
163
-
164
-
163
+
164
+
165
165
  context "Creating a single document" do
166
166
  setup do
167
167
  @doc_instance = @document.create({:first_name => 'John', :last_name => 'Nunemaker', :age => '27'})
@@ -194,7 +194,7 @@ class DocumentTest < Test::Unit::TestCase
194
194
  include MongoMapper::Document
195
195
  set_collection_name 'test'
196
196
  end
197
- @document.collection.clear
197
+ @document.collection.remove
198
198
  end
199
199
 
200
200
  should "create the document" do
@@ -298,7 +298,9 @@ class DocumentTest < Test::Unit::TestCase
298
298
  end
299
299
 
300
300
  should "raise error if document not found" do
301
- lambda { @document.find(123) }.should raise_error(MongoMapper::DocumentNotFound)
301
+ lambda {
302
+ @document.find(123)
303
+ }.should raise_error(MongoMapper::DocumentNotFound)
302
304
  end
303
305
  end
304
306
 
@@ -310,31 +312,31 @@ class DocumentTest < Test::Unit::TestCase
310
312
  should "work as array" do
311
313
  @document.find([@doc1.id, @doc2.id]).should == [@doc1, @doc2]
312
314
  end
313
-
315
+
314
316
  should "return array if array only has one element" do
315
317
  @document.find([@doc1.id]).should == [@doc1]
316
318
  end
317
319
  end
318
-
320
+
319
321
  should "be able to find using condition auto-detection" do
320
322
  @document.first(:first_name => 'John').should == @doc1
321
323
  @document.all(:last_name => 'Nunemaker', :order => 'age desc').should == [@doc1, @doc3]
322
324
  end
323
-
325
+
324
326
  context "with :all" do
325
327
  should "find all documents" do
326
328
  @document.find(:all, :order => 'first_name').should == [@doc1, @doc3, @doc2]
327
329
  end
328
330
 
329
331
  should "be able to add conditions" do
330
- @document.find(:all, :conditions => {:first_name => 'John'}).should == [@doc1]
332
+ @document.find(:all, :first_name => 'John').should == [@doc1]
331
333
  end
332
334
  end
333
335
 
334
336
  context "with #all" do
335
337
  should "find all documents based on criteria" do
336
338
  @document.all(:order => 'first_name').should == [@doc1, @doc3, @doc2]
337
- @document.all(:conditions => {:last_name => 'Nunemaker'}, :order => 'age desc').should == [@doc1, @doc3]
339
+ @document.all(:last_name => 'Nunemaker', :order => 'age desc').should == [@doc1, @doc3]
338
340
  end
339
341
  end
340
342
 
@@ -347,7 +349,7 @@ class DocumentTest < Test::Unit::TestCase
347
349
  context "with #first" do
348
350
  should "find first document based on criteria" do
349
351
  @document.first(:order => 'first_name').should == @doc1
350
- @document.first(:conditions => {:age => 28}).should == @doc2
352
+ @document.first(:age => 28).should == @doc2
351
353
  end
352
354
  end
353
355
 
@@ -360,13 +362,13 @@ class DocumentTest < Test::Unit::TestCase
360
362
  context "with #last" do
361
363
  should "find last document based on criteria" do
362
364
  @document.last(:order => 'age').should == @doc2
363
- @document.last(:order => 'age', :conditions => {:age => 28}).should == @doc2
365
+ @document.last(:order => 'age', :age => 28).should == @doc2
364
366
  end
365
-
367
+
366
368
  should "raise error if no order provided" do
367
369
  lambda { @document.last() }.should raise_error
368
370
  end
369
- end
371
+ end
370
372
 
371
373
  context "with :find_by" do
372
374
  should "find document based on argument" do
@@ -567,13 +569,13 @@ class DocumentTest < Test::Unit::TestCase
567
569
  class ::Property
568
570
  include MongoMapper::Document
569
571
  end
570
- Property.collection.clear
572
+ Property.collection.remove
571
573
 
572
574
  class ::Thing
573
575
  include MongoMapper::Document
574
576
  key :name, String
575
577
  end
576
- Thing.collection.clear
578
+ Thing.collection.remove
577
579
  end
578
580
 
579
581
  teardown do
@@ -668,11 +670,11 @@ class DocumentTest < Test::Unit::TestCase
668
670
  @thing.properties << @property3
669
671
  end
670
672
 
671
- should "destroy the thing" do
673
+ should "not execute on a belongs_to association" do
672
674
  Thing.count.should == 1
673
675
  @property1.destroy
674
- Thing.count.should == 0
675
- @property1.thing.should be_frozen
676
+ Thing.count.should == 1
677
+ @property1.should be_frozen
676
678
  end
677
679
  end
678
680
  end
@@ -699,7 +701,7 @@ class DocumentTest < Test::Unit::TestCase
699
701
  include MongoMapper::Document
700
702
  set_collection_name 'foobarbazwickdoesnotexist'
701
703
  end
702
- @document.collection.clear
704
+ @document.collection.remove
703
705
 
704
706
  klass.count.should == 0
705
707
  end
@@ -721,28 +723,34 @@ class DocumentTest < Test::Unit::TestCase
721
723
  should "allow creating index for a key" do
722
724
  @document.ensure_index :first_name
723
725
  MongoMapper.ensure_indexes!
724
-
725
- @document.should have_index('first_name_1')
726
+
727
+ @document.should have_index('first_name_1')
726
728
  end
727
729
 
728
730
  should "allow creating unique index for a key" do
729
731
  @document.ensure_index :first_name, :unique => true
730
732
  MongoMapper.ensure_indexes!
731
-
733
+
732
734
  @document.should have_index('first_name_1')
733
735
  end
734
736
 
735
737
  should "allow creating index on multiple keys" do
736
738
  @document.ensure_index [[:first_name, 1], [:last_name, -1]]
737
739
  MongoMapper.ensure_indexes!
738
-
739
- @document.should have_index('last_name_-1_first_name_1')
740
+
741
+ # order is different for different versions of ruby so instead of
742
+ # just checking have_index('first_name_1_last_name_-1') I'm checking
743
+ # the values of the indexes to make sure the index creation was successful
744
+ @document.collection.index_information.detect do |index|
745
+ keys = index[1]
746
+ keys.include?(['first_name', 1]) && keys.include?(['last_name', -1])
747
+ end.should_not be_nil
740
748
  end
741
749
 
742
750
  should "work with :index shortcut when defining key" do
743
751
  @document.key :father, String, :index => true
744
752
  MongoMapper.ensure_indexes!
745
-
753
+
746
754
  @document.should have_index('father_1')
747
755
  end
748
756
  end
@@ -789,7 +797,7 @@ class DocumentTest < Test::Unit::TestCase
789
797
  from_db = RealPerson.find(person.id)
790
798
  from_db.name.should == "David"
791
799
  end
792
-
800
+
793
801
  context "with key of type date" do
794
802
  should "save the date value as a Time object" do
795
803
  doc = @document.new(:first_name => 'John', :age => '27', :date => "12/01/2009")
@@ -886,16 +894,16 @@ class DocumentTest < Test::Unit::TestCase
886
894
  from_db.age.should == 30
887
895
  end
888
896
  end
889
-
897
+
890
898
  context "update_attributes" do
891
899
  setup do
892
900
  @document.key :foo, String, :required => true
893
901
  end
894
-
902
+
895
903
  should "return true if document valid" do
896
904
  @document.new.update_attributes(:foo => 'bar').should be_true
897
905
  end
898
-
906
+
899
907
  should "return false if document not valid" do
900
908
  @document.new.update_attributes({}).should be_false
901
909
  end
@@ -936,63 +944,164 @@ class DocumentTest < Test::Unit::TestCase
936
944
  end
937
945
  end
938
946
  end
939
-
947
+
940
948
  context "Single collection inheritance" do
941
949
  setup do
942
950
  class ::DocParent
943
951
  include MongoMapper::Document
944
952
  key :_type, String
953
+ key :name, String
945
954
  end
946
-
947
- class ::DocChild < ::DocParent; end
948
- DocParent.collection.clear
949
-
955
+ DocParent.collection.remove
956
+
957
+ class ::DocDaughter < ::DocParent; end
958
+ class ::DocSon < ::DocParent; end
959
+ class ::DocGrandSon < ::DocSon; end
960
+
950
961
  @parent = DocParent.new({:name => "Daddy Warbucks"})
951
- @child = DocChild.new({:name => "Little Orphan Annie"})
962
+ @daughter = DocDaughter.new({:name => "Little Orphan Annie"})
952
963
  end
953
964
 
954
965
  teardown do
955
- Object.send :remove_const, 'DocParent' if defined?(::DocParent)
956
- Object.send :remove_const, 'DocChild' if defined?(::DocChild)
966
+ Object.send :remove_const, 'DocParent' if defined?(::DocParent)
967
+ Object.send :remove_const, 'DocDaughter' if defined?(::DocDaughter)
968
+ Object.send :remove_const, 'DocSon' if defined?(::DocSon)
969
+ Object.send :remove_const, 'DocGrandSon' if defined?(::DocGrandSon)
957
970
  end
958
971
 
959
972
  should "use the same collection in the subclass" do
960
- DocChild.collection.name.should == DocParent.collection.name
973
+ DocDaughter.collection.name.should == DocParent.collection.name
961
974
  end
962
975
 
963
976
  should "assign the class name into the _type property" do
964
977
  @parent._type.should == 'DocParent'
965
- @child._type.should == 'DocChild'
978
+ @daughter._type.should == 'DocDaughter'
966
979
  end
967
980
 
968
981
  should "load the document with the assigned type" do
969
982
  @parent.save
970
- @child.save
983
+ @daughter.save
971
984
 
972
985
  collection = DocParent.find(:all)
973
986
  collection.size.should == 2
974
987
  collection.first.should be_kind_of(DocParent)
975
988
  collection.first.name.should == "Daddy Warbucks"
976
- collection.last.should be_kind_of(DocChild)
989
+ collection.last.should be_kind_of(DocDaughter)
977
990
  collection.last.name.should == "Little Orphan Annie"
978
991
  end
979
-
992
+
980
993
  should "gracefully handle when the type can't be constantized" do
981
994
  doc = DocParent.new(:name => 'Nunes')
982
995
  doc._type = 'FoobarBaz'
983
996
  doc.save
984
-
997
+
985
998
  collection = DocParent.all
986
999
  collection.last.should == doc
987
1000
  collection.last.should be_kind_of(DocParent)
988
1001
  end
1002
+
1003
+ should "find scoped to class" do
1004
+ john = DocSon.create(:name => 'John')
1005
+ steve = DocSon.create(:name => 'Steve')
1006
+ steph = DocDaughter.create(:name => 'Steph')
1007
+ carrie = DocDaughter.create(:name => 'Carrie')
1008
+
1009
+ DocGrandSon.all(:order => 'name').should == []
1010
+ DocSon.all(:order => 'name').should == [john, steve]
1011
+ DocDaughter.all(:order => 'name').should == [carrie, steph]
1012
+ DocParent.all(:order => 'name').should == [carrie, john, steph, steve]
1013
+ end
1014
+
1015
+ should "work with nested hash conditions" do
1016
+ john = DocSon.create(:name => 'John')
1017
+ steve = DocSon.create(:name => 'Steve')
1018
+ DocSon.all(:name => {'$ne' => 'Steve'}).should == [john]
1019
+ end
1020
+
1021
+ should "raise error if not found scoped to class" do
1022
+ john = DocSon.create(:name => 'John')
1023
+ steph = DocDaughter.create(:name => 'Steph')
1024
+
1025
+ lambda {
1026
+ DocSon.find(steph.id)
1027
+ }.should raise_error(MongoMapper::DocumentNotFound)
1028
+ end
1029
+
1030
+ should "not raise error for find with parent" do
1031
+ john = DocSon.create(:name => 'John')
1032
+
1033
+ DocParent.find(john.id).should == john
1034
+ end
1035
+
1036
+ should "count scoped to class" do
1037
+ john = DocSon.create(:name => 'John')
1038
+ steve = DocSon.create(:name => 'Steve')
1039
+ steph = DocDaughter.create(:name => 'Steph')
1040
+ carrie = DocDaughter.create(:name => 'Carrie')
1041
+
1042
+ DocGrandSon.count.should == 0
1043
+ DocSon.count.should == 2
1044
+ DocDaughter.count.should == 2
1045
+ DocParent.count.should == 4
1046
+ end
1047
+
1048
+ should "know if it is single_collection_inherited?" do
1049
+ DocParent.single_collection_inherited?.should be_false
1050
+
1051
+ DocDaughter.single_collection_inherited?.should be_true
1052
+ DocSon.single_collection_inherited?.should be_true
1053
+ end
1054
+
1055
+ should "know if single_collection_inherited_superclass?" do
1056
+ DocParent.single_collection_inherited_superclass?.should be_false
1057
+
1058
+ DocDaughter.single_collection_inherited_superclass?.should be_true
1059
+ DocSon.single_collection_inherited_superclass?.should be_true
1060
+ DocGrandSon.single_collection_inherited_superclass?.should be_true
1061
+ end
1062
+
1063
+ should "not be able to destroy each other" do
1064
+ john = DocSon.create(:name => 'John')
1065
+ steph = DocDaughter.create(:name => 'Steph')
1066
+
1067
+ lambda {
1068
+ DocSon.destroy(steph.id)
1069
+ }.should raise_error(MongoMapper::DocumentNotFound)
1070
+ end
1071
+
1072
+ should "not be able to delete each other" do
1073
+ john = DocSon.create(:name => 'John')
1074
+ steph = DocDaughter.create(:name => 'Steph')
1075
+
1076
+ lambda {
1077
+ DocSon.delete(steph.id)
1078
+ }.should_not change { DocParent.count }
1079
+ end
1080
+
1081
+ should "be able to destroy using parent" do
1082
+ john = DocSon.create(:name => 'John')
1083
+ steph = DocDaughter.create(:name => 'Steph')
1084
+
1085
+ lambda {
1086
+ DocParent.destroy_all
1087
+ }.should change { DocParent.count }.by(-2)
1088
+ end
1089
+
1090
+ should "be able to delete using parent" do
1091
+ john = DocSon.create(:name => 'John')
1092
+ steph = DocDaughter.create(:name => 'Steph')
1093
+
1094
+ lambda {
1095
+ DocParent.delete_all
1096
+ }.should change { DocParent.count }.by(-2)
1097
+ end
989
1098
  end
990
1099
 
991
1100
  context "timestamping" do
992
1101
  setup do
993
1102
  @document.timestamps!
994
1103
  end
995
-
1104
+
996
1105
  should "set created_at and updated_at on create" do
997
1106
  doc = @document.new(:first_name => 'John', :age => 27)
998
1107
  doc.created_at.should be(nil)
@@ -1007,11 +1116,11 @@ class DocumentTest < Test::Unit::TestCase
1007
1116
  old_created_at = doc.created_at
1008
1117
  old_updated_at = doc.updated_at
1009
1118
  doc.first_name = 'Johnny'
1010
-
1119
+
1011
1120
  Timecop.freeze(Time.now + 5.seconds) do
1012
1121
  doc.save
1013
1122
  end
1014
-
1123
+
1015
1124
  doc.created_at.should == old_created_at
1016
1125
  doc.updated_at.should_not == old_updated_at
1017
1126
  end
@@ -1020,7 +1129,7 @@ class DocumentTest < Test::Unit::TestCase
1020
1129
  doc = @document.create(:first_name => 'John', :age => 27)
1021
1130
  old_created_at = doc.created_at
1022
1131
  old_updated_at = doc.updated_at
1023
-
1132
+
1024
1133
  Timecop.freeze(Time.now + 5.seconds) do
1025
1134
  @document.update(doc._id, { :first_name => 'Johnny' })
1026
1135
  end
@@ -1053,4 +1162,16 @@ class DocumentTest < Test::Unit::TestCase
1053
1162
  @document.exists?(:first_name => "Jean").should == false
1054
1163
  end
1055
1164
  end
1165
+
1166
+ context "reload" do
1167
+ setup do
1168
+ @doc_instance_1 = @document.create({:first_name => 'Ryan', :last_name => 'Koopmans', :age => '37'})
1169
+ @doc_instance_2 = @document.update(@doc_instance_1.id, {:age => '39'})
1170
+ end
1171
+
1172
+ should "load fresh information from the database" do
1173
+ @doc_instance_1.age.should == 37
1174
+ @doc_instance_1.reload.age.should == 39
1175
+ end
1176
+ end
1056
1177
  end
@@ -10,7 +10,7 @@ class EmbeddedDocumentTest < Test::Unit::TestCase
10
10
  key :first_name, String
11
11
  key :last_name, String
12
12
  end
13
- @document.collection.clear
13
+ @document.collection.remove
14
14
  end
15
15
 
16
16
  context "Saving a document with an embedded document" do
@@ -13,7 +13,7 @@ class PaginationTest < Test::Unit::TestCase
13
13
 
14
14
  def self.per_page; 1 end
15
15
  end
16
- @document.collection.clear
16
+ @document.collection.remove
17
17
 
18
18
  @doc1 = @document.create({:first_name => 'John', :last_name => 'Nunemaker', :age => '27'})
19
19
  @doc2 = @document.create({:first_name => 'Steve', :last_name => 'Smith', :age => '28'})
@@ -43,41 +43,41 @@ class PaginationTest < Test::Unit::TestCase
43
43
 
44
44
  should "accept conditions" do
45
45
  result = @document.paginate({
46
- :conditions => {:last_name => 'Nunemaker'},
47
- :order => "age DESC",
48
- :per_page => 2,
49
- :page => 1,
46
+ :last_name => 'Nunemaker',
47
+ :order => "age DESC",
48
+ :per_page => 2,
49
+ :page => 1,
50
50
  })
51
51
  result.should == [@doc1, @doc3]
52
52
  result.first.age.should == 27
53
53
  end
54
54
 
55
- should "withstand rigor" do
55
+ should "withstand rigor" do
56
56
  result = @document.paginate({
57
- :per_page => 1,
58
- :page => 1,
59
- :order => 'age desc',
60
- :conditions => {:last_name => 'Nunemaker'}
57
+ :per_page => 1,
58
+ :page => 1,
59
+ :order => 'age desc',
60
+ :last_name => 'Nunemaker'
61
61
  })
62
62
  result.should == [@doc1]
63
63
  result.total_entries.should == 2
64
64
  result.total_pages.should == 2
65
65
 
66
66
  result = @document.paginate({
67
- :per_page => 1,
68
- :page => 2,
69
- :order => 'age desc',
70
- :conditions => {:last_name => 'Nunemaker'}
67
+ :per_page => 1,
68
+ :page => 2,
69
+ :order => 'age desc',
70
+ :last_name => 'Nunemaker'
71
71
  })
72
72
  result.should == [@doc3]
73
73
  result.total_entries.should == 2
74
74
  result.total_pages.should == 2
75
75
 
76
76
  result = @document.paginate({
77
- :per_page => 2,
78
- :page => 1,
79
- :order => 'age desc',
80
- :conditions => {:last_name => 'Nunemaker'}
77
+ :per_page => 2,
78
+ :page => 1,
79
+ :order => 'age desc',
80
+ :last_name => 'Nunemaker'
81
81
  })
82
82
  result.should == [@doc1, @doc3]
83
83
  result.total_entries.should == 2
@@ -14,7 +14,7 @@ class TestRailsCompatibility < Test::Unit::TestCase
14
14
 
15
15
  context "Document" do
16
16
  setup do
17
- Order.collection.clear
17
+ Order.collection.remove
18
18
  end
19
19
 
20
20
  should "alias new to new_record?" do