mongomodel 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/Appraisals +12 -0
  2. data/bin/console +1 -2
  3. data/gemfiles/mongo_mapper.gemfile +12 -0
  4. data/gemfiles/mongoid.gemfile +12 -0
  5. data/lib/mongomodel.rb +3 -0
  6. data/lib/mongomodel/compatibility/mongo_mapper.rb +23 -0
  7. data/lib/mongomodel/compatibility/mongoid.rb +17 -0
  8. data/lib/mongomodel/concerns/properties.rb +5 -0
  9. data/lib/mongomodel/concerns/validations.rb +5 -3
  10. data/lib/mongomodel/support/core_extensions.rb +4 -4
  11. data/lib/mongomodel/support/mongo_options.rb +4 -2
  12. data/lib/mongomodel/support/mongo_order.rb +4 -0
  13. data/lib/mongomodel/support/scope.rb +1 -1
  14. data/lib/mongomodel/version.rb +1 -1
  15. data/spec/mongomodel/attributes/store_spec.rb +12 -12
  16. data/spec/mongomodel/concerns/associations/belongs_to_spec.rb +13 -13
  17. data/spec/mongomodel/concerns/associations/has_many_by_foreign_key_spec.rb +25 -25
  18. data/spec/mongomodel/concerns/associations/has_many_by_ids_spec.rb +25 -25
  19. data/spec/mongomodel/concerns/attribute_methods/before_type_cast_spec.rb +5 -5
  20. data/spec/mongomodel/concerns/attribute_methods/dirty_spec.rb +21 -21
  21. data/spec/mongomodel/concerns/attribute_methods/multi_parameter_assignment_spec.rb +3 -3
  22. data/spec/mongomodel/concerns/attribute_methods/protected_spec.rb +10 -10
  23. data/spec/mongomodel/concerns/attribute_methods/query_spec.rb +6 -6
  24. data/spec/mongomodel/concerns/attribute_methods/read_spec.rb +6 -6
  25. data/spec/mongomodel/concerns/attribute_methods/write_spec.rb +5 -5
  26. data/spec/mongomodel/concerns/attribute_methods_spec.rb +5 -5
  27. data/spec/mongomodel/concerns/attributes_spec.rb +13 -13
  28. data/spec/mongomodel/concerns/callbacks_spec.rb +11 -11
  29. data/spec/mongomodel/concerns/logging_spec.rb +2 -2
  30. data/spec/mongomodel/concerns/observing_spec.rb +3 -3
  31. data/spec/mongomodel/concerns/pretty_inspect_spec.rb +5 -5
  32. data/spec/mongomodel/concerns/properties_spec.rb +6 -6
  33. data/spec/mongomodel/concerns/serialization/json_serialization_spec.rb +6 -6
  34. data/spec/mongomodel/concerns/timestamps_spec.rb +10 -10
  35. data/spec/mongomodel/concerns/translation_spec.rb +1 -1
  36. data/spec/mongomodel/concerns/validations_spec.rb +12 -4
  37. data/spec/mongomodel/document/callbacks_spec.rb +10 -10
  38. data/spec/mongomodel/document/collection_modifiers_spec.rb +1 -1
  39. data/spec/mongomodel/document/dynamic_finders_spec.rb +5 -5
  40. data/spec/mongomodel/document/finders_spec.rb +9 -9
  41. data/spec/mongomodel/document/indexes_spec.rb +19 -19
  42. data/spec/mongomodel/document/optimistic_locking_spec.rb +8 -8
  43. data/spec/mongomodel/document/persistence_spec.rb +38 -38
  44. data/spec/mongomodel/document/scopes_spec.rb +8 -8
  45. data/spec/mongomodel/document/validations/uniqueness_spec.rb +9 -9
  46. data/spec/mongomodel/document/validations_spec.rb +16 -16
  47. data/spec/mongomodel/document_spec.rb +11 -11
  48. data/spec/mongomodel/embedded_document_spec.rb +13 -13
  49. data/spec/mongomodel/mongomodel_spec.rb +4 -4
  50. data/spec/mongomodel/support/collection_spec.rb +40 -40
  51. data/spec/mongomodel/support/map_spec.rb +41 -41
  52. data/spec/mongomodel/support/mongo_operator_spec.rb +11 -9
  53. data/spec/mongomodel/support/mongo_options_spec.rb +17 -17
  54. data/spec/mongomodel/support/mongo_order_spec.rb +22 -22
  55. data/spec/mongomodel/support/property_spec.rb +21 -12
  56. data/spec/mongomodel/support/scope_spec.rb +134 -134
  57. data/spec/spec_helper.rb +1 -0
  58. data/spec/specdoc.opts +0 -3
  59. metadata +7 -5
@@ -18,7 +18,7 @@ module MongoModel
18
18
  TestModel.new(:name => 'Hello World', :age => 25, :paid => true, :prefs => { :foo => 'bar' }, :internal => 'hideme')
19
19
  end
20
20
 
21
- it "should include root in json" do
21
+ it "includes root in json" do
22
22
  begin
23
23
  TestModel.include_root_in_json = true
24
24
 
@@ -29,7 +29,7 @@ module MongoModel
29
29
  end
30
30
  end
31
31
 
32
- it "should encode all public attributes" do
32
+ it "encodes all public attributes" do
33
33
  json = instance.to_json
34
34
  json.should match(/"name":"Hello World"/)
35
35
  json.should match(/"age":25/)
@@ -37,12 +37,12 @@ module MongoModel
37
37
  json.should match(/"prefs":\{"foo":"bar"\}/)
38
38
  end
39
39
 
40
- it "should not encode internal attributes" do
40
+ it "does not encode internal attributes" do
41
41
  json = instance.to_json
42
42
  json.should_not match(/"internal":"hideme"/)
43
43
  end
44
44
 
45
- it "should allow attribute filtering with only" do
45
+ it "allows attribute filtering with only" do
46
46
  json = instance.to_json(:only => [:name, :age])
47
47
  json.should match(/"name":"Hello World"/)
48
48
  json.should match(/"age":25/)
@@ -50,7 +50,7 @@ module MongoModel
50
50
  json.should_not match(/"prefs":\{"foo":"bar"\}/)
51
51
  end
52
52
 
53
- it "should allow attribute filtering with except" do
53
+ it "allows attribute filtering with except" do
54
54
  json = instance.to_json(:except => [:name, :age])
55
55
  json.should_not match(/"name":"Hello World"/)
56
56
  json.should_not match(/"age":25/)
@@ -58,7 +58,7 @@ module MongoModel
58
58
  json.should match(/"prefs":\{"foo":"bar"\}/)
59
59
  end
60
60
 
61
- it "should allow methods to be included" do
61
+ it "allows methods to be included" do
62
62
  json = instance.to_json(:methods => [:hello, :type])
63
63
  json.should match(/"hello":"Hi friend!"/)
64
64
  json.should match(/"type":"TestModel"/)
@@ -8,12 +8,12 @@ module MongoModel
8
8
  timestamps!
9
9
  end
10
10
 
11
- it "should define a Time property updated_at" do
11
+ it "defines a Time property updated_at" do
12
12
  TestDocument.properties.should include(:updated_at)
13
13
  TestDocument.properties[:updated_at].type.should == Time
14
14
  end
15
15
 
16
- it "should define a Time property created_at" do
16
+ it "defines a Time property created_at" do
17
17
  TestDocument.properties.should include(:created_at)
18
18
  TestDocument.properties[:created_at].type.should == Time
19
19
  end
@@ -42,7 +42,7 @@ module MongoModel
42
42
  Time.stub!(:now).and_return(@now)
43
43
  end
44
44
 
45
- it "should set the updated_at property to the current time when saved" do
45
+ it "sets the updated_at property to the current time when saved" do
46
46
  doc.save
47
47
  subject.updated_at.should == @now
48
48
  end
@@ -66,7 +66,7 @@ module MongoModel
66
66
 
67
67
  subject { TestDocument.new }
68
68
 
69
- it "should set the updated_on property to the current date when saved" do
69
+ it "sets the updated_on property to the current date when saved" do
70
70
  doc.save
71
71
  subject.updated_on.should == Date.today
72
72
  end
@@ -95,12 +95,12 @@ module MongoModel
95
95
  Time.stub!(:now).and_return(@now)
96
96
  end
97
97
 
98
- it "should set the created_at property to the current time when created" do
98
+ it "sets the created_at property to the current time when created" do
99
99
  doc.save
100
100
  subject.created_at.should == @now
101
101
  end
102
102
 
103
- it "should not change the created_at property when updated" do
103
+ it "does not change the created_at property when updated" do
104
104
  @next = 1.day.from_now
105
105
 
106
106
  Time.stub!(:now).and_return(@now)
@@ -113,7 +113,7 @@ module MongoModel
113
113
  subject.created_at.should == @now
114
114
  end
115
115
 
116
- it "should preserve created_at attribute when set explicitly" do
116
+ it "preserves created_at attribute when set explicitly" do
117
117
  @a_year_ago = 1.year.ago
118
118
 
119
119
  subject.created_at = @a_year_ago
@@ -141,12 +141,12 @@ module MongoModel
141
141
 
142
142
  subject { TestDocument.new }
143
143
 
144
- it "should set the created_on property to the current date when created" do
144
+ it "sets the created_on property to the current date when created" do
145
145
  doc.save
146
146
  subject.created_on.should == Date.today
147
147
  end
148
148
 
149
- it "should not change the created_on property when updated" do
149
+ it "does not change the created_on property when updated" do
150
150
  doc.save
151
151
 
152
152
  @today = Date.today
@@ -158,7 +158,7 @@ module MongoModel
158
158
  subject.created_on.should == @today
159
159
  end
160
160
 
161
- it "should preserve created_on attribute when set explicitly" do
161
+ it "preserves created_on attribute when set explicitly" do
162
162
  @a_year_ago = 1.year.ago.to_date
163
163
 
164
164
  subject.created_on = @a_year_ago
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module MongoModel
4
4
  specs_for(Document, EmbeddedDocument) do
5
- it "should use correct i18n scope" do
5
+ it "uses correct i18n scope" do
6
6
  described_class.i18n_scope.should == :mongomodel
7
7
  end
8
8
  end
@@ -26,7 +26,7 @@ module MongoModel
26
26
  subject { doc }
27
27
  end
28
28
 
29
- it "should have an errors collection" do
29
+ it "has an errors collection" do
30
30
  subject.errors.should be_an_instance_of(ActiveModel::Errors)
31
31
  end
32
32
 
@@ -87,7 +87,7 @@ module MongoModel
87
87
 
88
88
  it { should be_valid }
89
89
 
90
- it "should not be valid in custom context" do
90
+ it "is not valid in custom context" do
91
91
  subject.valid?(:custom).should be_false
92
92
  end
93
93
  end
@@ -95,20 +95,28 @@ module MongoModel
95
95
 
96
96
  describe "validation shortcuts" do
97
97
  define_class(:TestDocument, described_class)
98
+ define_class(:SubDocument, EmbeddedDocument)
98
99
 
99
100
  describe ":required => true" do
100
- it "should add a validates_presence_of validation" do
101
+ it "adds a validates_presence_of validation" do
101
102
  TestDocument.should_receive(:validates_presence_of).with(:title)
102
103
  TestDocument.property :title, String, :required => true
103
104
  end
104
105
  end
105
106
 
106
107
  describe ":format => /regex/" do
107
- it "should add a validates_format_of validation" do
108
+ it "adds a validates_format_of validation" do
108
109
  TestDocument.should_receive(:validates_format_of).with(:email, /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i)
109
110
  TestDocument.property :email, String, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
110
111
  end
111
112
  end
113
+
114
+ describe ":validate => false" do
115
+ it "skips validations on embedded/associated models" do
116
+ TestDocument.should_not_receive(:validates_associated).with(:sub_object)
117
+ TestDocument.property :sub_object, SubDocument, :validate => false
118
+ end
119
+ end
112
120
  end
113
121
  end
114
122
 
@@ -9,46 +9,46 @@ module MongoModel
9
9
 
10
10
  let(:doc) { CallbackTestDocument.create! }
11
11
 
12
- it "should run each type of callback when initializing" do
12
+ it "runs each type of callback when initializing" do
13
13
  instance = CallbackTestDocument.new
14
14
  instance.should run_callbacks(:after_initialize)
15
15
  end
16
16
 
17
- it "should run each type of callback on find" do
17
+ it "runs each type of callback on find" do
18
18
  instance = CallbackTestDocument.find(doc.id)
19
19
  instance.should run_callbacks(:after_initialize, :after_find)
20
20
  end
21
21
 
22
- it "should run each type of callback when validating a new document" do
22
+ it "runs each type of callback when validating a new document" do
23
23
  instance = CallbackTestDocument.new
24
24
  instance.valid?
25
25
  instance.should run_callbacks(:after_initialize, :before_validation, :after_validation)
26
26
  end
27
27
 
28
- it "should run each type of callback when validating an existing document" do
28
+ it "runs each type of callback when validating an existing document" do
29
29
  instance = CallbackTestDocument.find(doc.id)
30
30
  instance.valid?
31
31
  instance.should run_callbacks(:after_initialize, :after_find, :before_validation, :after_validation)
32
32
  end
33
33
 
34
- it "should run each type of callback when creating a document" do
34
+ it "runs each type of callback when creating a document" do
35
35
  instance = CallbackTestDocument.create!
36
36
  instance.should run_callbacks(:after_initialize, :before_validation, :after_validation, :before_save, :before_create, :after_create, :after_save)
37
37
  end
38
38
 
39
- it "should run each type of callback when saving an existing document" do
39
+ it "runs each type of callback when saving an existing document" do
40
40
  instance = CallbackTestDocument.find(doc.id)
41
41
  instance.save
42
42
  instance.should run_callbacks(:after_initialize, :after_find, :before_validation, :after_validation, :before_save, :before_update, :after_update, :after_save)
43
43
  end
44
44
 
45
- it "should run each type of callback when destroying a document" do
45
+ it "runs each type of callback when destroying a document" do
46
46
  instance = CallbackTestDocument.find(doc.id)
47
47
  instance.destroy
48
48
  instance.should run_callbacks(:after_initialize, :after_find, :before_destroy, :after_destroy)
49
49
  end
50
50
 
51
- it "should not run destroy callbacks when deleting a document" do
51
+ it "does not run destroy callbacks when deleting a document" do
52
52
  instance = CallbackTestDocument.find(doc.id)
53
53
  instance.delete
54
54
  instance.should run_callbacks(:after_initialize, :after_find)
@@ -64,13 +64,13 @@ module MongoModel
64
64
  subject { CallbackTestDocument.new }
65
65
 
66
66
  describe "#save" do
67
- it "should return false" do
67
+ it "returns false" do
68
68
  subject.save.should be_false
69
69
  end
70
70
  end
71
71
 
72
72
  describe "#save!" do
73
- it "should raise a MongoModel::DocumentNotSaved exception" do
73
+ it "raises a MongoModel::DocumentNotSaved exception" do
74
74
  lambda { subject.save! }.should raise_error(MongoModel::DocumentNotSaved)
75
75
  end
76
76
  end
@@ -13,7 +13,7 @@ module MongoModel
13
13
  subject { Post }
14
14
 
15
15
  def self.should_update_collection(expression, &block)
16
- it "should update the collection" do
16
+ it "updates the collection" do
17
17
  collection.should_receive(:update).with(selector, expression, :multi => true)
18
18
  instance_eval(&block)
19
19
  end
@@ -19,21 +19,21 @@ module MongoModel
19
19
  end
20
20
 
21
21
  def self.should_find(*args, &block)
22
- it "should return correct results when called with #{args.inspect}" do
22
+ it "returns correct results when called with #{args.inspect}" do
23
23
  expected = instance_eval(&block)
24
24
  subject.send(valid_finder, *args).should == expected
25
25
  end
26
26
  end
27
27
 
28
28
  def self.should_raise(*args, &block)
29
- it "should raise DocumentNotFound exception if results not found" do
29
+ it "raises DocumentNotFound exception if results not found" do
30
30
  message = instance_eval(&block)
31
31
  lambda { subject.send(valid_finder, *args) }.should raise_error(DocumentNotFound, message)
32
32
  end
33
33
  end
34
34
 
35
35
  def self.should_initialize(*args, &block)
36
- it "should initialize new instance" do
36
+ it "initializes new instance" do
37
37
  result = subject.send(valid_finder, *args)
38
38
  result.should be_a_new_record
39
39
  result.should be_an_instance_of(Person)
@@ -42,7 +42,7 @@ module MongoModel
42
42
  end
43
43
 
44
44
  def self.should_create(*args, &block)
45
- it "should create new instance" do
45
+ it "creates new instance" do
46
46
  result = subject.send(valid_finder, *args)
47
47
  result.should_not be_a_new_record
48
48
  result.should be_an_instance_of(Person)
@@ -54,7 +54,7 @@ module MongoModel
54
54
  it { should respond_to(valid_finder) }
55
55
  it { should_not respond_to(invalid_finder) }
56
56
 
57
- it "should raise NoMethodError calling an invalid finder" do
57
+ it "raises NoMethodError calling an invalid finder" do
58
58
  lambda { subject.send(invalid_finder, "Foo") }.should raise_error(NoMethodError)
59
59
  end
60
60
  end
@@ -20,24 +20,24 @@ module MongoModel
20
20
  context "document exists" do
21
21
  subject { User.find('2') }
22
22
 
23
- it "should return a User" do
23
+ it "returns a User" do
24
24
  subject.should be_a(User)
25
25
  end
26
26
 
27
- it "should load the document attributes" do
27
+ it "loads the document attributes" do
28
28
  subject.id.should == '2'
29
29
  subject.name.should == 'Alistair'
30
30
  end
31
31
 
32
32
  it { should_not be_a_new_record }
33
33
 
34
- it "should stringify ids" do
34
+ it "stringifies ids" do
35
35
  User.find(2).id.should == '2'
36
36
  end
37
37
  end
38
38
 
39
39
  context "document does not exist" do
40
- it "should raise a DocumentNotFound exception" do
40
+ it "raises a DocumentNotFound exception" do
41
41
  lambda {
42
42
  User.find('4')
43
43
  }.should raise_error(MongoModel::DocumentNotFound)
@@ -45,7 +45,7 @@ module MongoModel
45
45
  end
46
46
 
47
47
  context "no id specified" do
48
- it "should raise an ArgumentError" do
48
+ it "raises an ArgumentError" do
49
49
  lambda {
50
50
  User.find
51
51
  }.should raise_error(ArgumentError)
@@ -57,17 +57,17 @@ module MongoModel
57
57
  context "all documents exist" do
58
58
  subject { User.find('1', '2') }
59
59
 
60
- it "should return an array of Users" do
60
+ it "returns an array of Users" do
61
61
  subject[0].should be_a(User)
62
62
  subject[1].should be_a(User)
63
63
  end
64
64
 
65
- it "should load document attributes" do
65
+ it "loads document attributes" do
66
66
  subject[0].name.should == 'Fred'
67
67
  subject[1].name.should == 'Alistair'
68
68
  end
69
69
 
70
- it "should load documents in correct order" do
70
+ it "loads documents in correct order" do
71
71
  result = User.find('2', '1')
72
72
  result[0].id.should == '2'
73
73
  result[1].id.should == '1'
@@ -75,7 +75,7 @@ module MongoModel
75
75
  end
76
76
 
77
77
  context "some documents missing" do
78
- it "should raise a DocumentNotFound exception" do
78
+ it "raises a DocumentNotFound exception" do
79
79
  lambda {
80
80
  User.find('1', '2', '4')
81
81
  }.should raise_error(MongoModel::DocumentNotFound)
@@ -13,23 +13,23 @@ module MongoModel
13
13
  Class.new(klass)
14
14
  end
15
15
 
16
- it "should have an indexes collection" do
16
+ it "has an indexes collection" do
17
17
  Article.indexes.should be_an_instance_of(Array)
18
18
  end
19
19
 
20
- it "should inherit indexes from parent classes" do
20
+ it "inherits indexes from parent classes" do
21
21
  index = mock('index')
22
22
  Article.indexes << index
23
23
  subclass(Article).indexes.should include(index)
24
24
  end
25
25
 
26
26
  describe "#index" do
27
- it "should add an index to the indexes collection" do
27
+ it "adds an index to the indexes collection" do
28
28
  Article.index :title, :unique => true
29
29
  Article.indexes.last.should == Index.new(:title, :unique => true)
30
30
  end
31
31
 
32
- it "should mark indexes as uninitialized" do
32
+ it "marks indexes as uninitialized" do
33
33
  Article.ensure_indexes!
34
34
 
35
35
  Article.indexes_initialized?.should be_true
@@ -45,7 +45,7 @@ module MongoModel
45
45
  Article.index :position => :geo2d, :min => -100, :max => 100
46
46
  end
47
47
 
48
- it "should create indexes on the collection" do
48
+ it "creates indexes on the collection" do
49
49
  Article.collection.should_receive(:create_index).with(:_type)
50
50
  Article.collection.should_receive(:create_index).with(:title, :unique => true)
51
51
  Article.collection.should_receive(:create_index).with([[:age, Mongo::DESCENDING]])
@@ -53,7 +53,7 @@ module MongoModel
53
53
  Article.ensure_indexes!
54
54
  end
55
55
 
56
- it "should mark indexes as initialized" do
56
+ it "marks indexes as initialized" do
57
57
  Article.indexes_initialized?.should be_false
58
58
  Article.ensure_indexes!
59
59
  Article.indexes_initialized?.should be_true
@@ -61,12 +61,12 @@ module MongoModel
61
61
  end
62
62
 
63
63
  describe "#_find" do
64
- it "should run ensure_indexes!" do
64
+ it "runs ensure_indexes!" do
65
65
  Article.should_receive(:ensure_indexes!)
66
66
  Article.first
67
67
  end
68
68
 
69
- it "should rerun ensure_indexes! if indexes are initialized" do
69
+ it "reruns ensure_indexes! if indexes are initialized" do
70
70
  Article.ensure_indexes!
71
71
  Article.should_not_receive(:ensure_indexes!)
72
72
  Article.first
@@ -78,7 +78,7 @@ module MongoModel
78
78
  define_class(:TestDocument, Document)
79
79
 
80
80
  describe ":index => true" do
81
- it "should add an index on the property" do
81
+ it "adds an index on the property" do
82
82
  TestDocument.should_receive(:index).with(:title)
83
83
  TestDocument.property :title, String, :index => true
84
84
  end
@@ -87,44 +87,44 @@ module MongoModel
87
87
  end
88
88
 
89
89
  describe Index do
90
- it "should convert index with single key to arguments for Mongo::Collection#create_index" do
90
+ it "converts index with single key to arguments for Mongo::Collection#create_index" do
91
91
  Index.new(:title).to_args.should == [:title]
92
92
  end
93
93
 
94
- it "should convert nested index with single key to arguments for Mongo::Collection#create_index" do
94
+ it "converts nested index with single key to arguments for Mongo::Collection#create_index" do
95
95
  Index.new('page.title').to_args.should == [:'page.title']
96
96
  end
97
97
 
98
- it "should convert index with unique option to arguments for Mongo::Collection#create_index" do
98
+ it "converts index with unique option to arguments for Mongo::Collection#create_index" do
99
99
  Index.new(:title, :unique => true).to_args.should == [:title, { :unique => true }]
100
100
  end
101
101
 
102
- it "should convert index with descending key to arguments for Mongo::Collection#create_index" do
102
+ it "converts index with descending key to arguments for Mongo::Collection#create_index" do
103
103
  Index.new(:title => :descending).to_args.should == [[[:title, Mongo::DESCENDING]]]
104
104
  end
105
105
 
106
- it "should convert index with multiple keys to arguments for Mongo::Collection#create_index" do
106
+ it "converts index with multiple keys to arguments for Mongo::Collection#create_index" do
107
107
  Index.new(:title, :age).to_args.should == [[[:age, Mongo::ASCENDING], [:title, Mongo::ASCENDING]]]
108
108
  end
109
109
 
110
- it "should convert index with multiple keys (ascending and descending) to arguments for Mongo::Collection#create_index" do
110
+ it "converts index with multiple keys (ascending and descending) to arguments for Mongo::Collection#create_index" do
111
111
  Index.new(:title => :ascending, :age => :descending).to_args.should == [[[:age, Mongo::DESCENDING], [:title, Mongo::ASCENDING]]]
112
112
  end
113
113
 
114
- it "should convert geospatial index with no options" do
114
+ it "converts geospatial index with no options" do
115
115
  Index.new(:position => :geo2d).to_args.should == [[[:position, Mongo::GEO2D]]]
116
116
  end
117
117
 
118
- it "should convert geospatial index with min/max options" do
118
+ it "converts geospatial index with min/max options" do
119
119
  Index.new(:position => :geo2d, :min => -50, :max => 50).to_args.should == [[[:position, Mongo::GEO2D]], { :min => -50, :max => 50 }]
120
120
  end
121
121
 
122
- it "should be equal to an equivalent index" do
122
+ it "is equal to an equivalent index" do
123
123
  Index.new(:title).should == Index.new(:title)
124
124
  Index.new(:title, :age).should == Index.new(:title => :ascending, :age => :ascending)
125
125
  end
126
126
 
127
- it "should not be equal to an non-equivalent index" do
127
+ it "is not equal to an non-equivalent index" do
128
128
  Index.new(:title).should_not == Index.new(:age)
129
129
  Index.new(:title, :age).should_not == Index.new(:title => :ascending, :age => :descending)
130
130
  end