mongo_mapper 0.13.1 → 0.14.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +13 -5
  2. data/README.rdoc +3 -6
  3. data/lib/mongo_mapper.rb +1 -0
  4. data/lib/mongo_mapper/document.rb +2 -0
  5. data/lib/mongo_mapper/extensions/array.rb +14 -6
  6. data/lib/mongo_mapper/extensions/hash.rb +15 -3
  7. data/lib/mongo_mapper/extensions/object.rb +4 -0
  8. data/lib/mongo_mapper/extensions/string.rb +13 -5
  9. data/lib/mongo_mapper/plugins/accessible.rb +12 -11
  10. data/lib/mongo_mapper/plugins/associations.rb +7 -6
  11. data/lib/mongo_mapper/plugins/associations/base.rb +13 -12
  12. data/lib/mongo_mapper/plugins/associations/belongs_to_polymorphic_proxy.rb +9 -8
  13. data/lib/mongo_mapper/plugins/associations/belongs_to_proxy.rb +12 -11
  14. data/lib/mongo_mapper/plugins/associations/embedded_collection.rb +4 -4
  15. data/lib/mongo_mapper/plugins/associations/in_array_proxy.rb +24 -23
  16. data/lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb +18 -16
  17. data/lib/mongo_mapper/plugins/associations/many_documents_proxy.rb +55 -48
  18. data/lib/mongo_mapper/plugins/associations/many_embedded_polymorphic_proxy.rb +14 -13
  19. data/lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb +7 -6
  20. data/lib/mongo_mapper/plugins/associations/many_polymorphic_proxy.rb +7 -5
  21. data/lib/mongo_mapper/plugins/associations/one_as_proxy.rb +14 -11
  22. data/lib/mongo_mapper/plugins/associations/one_embedded_polymorphic_proxy.rb +14 -13
  23. data/lib/mongo_mapper/plugins/associations/one_embedded_proxy.rb +9 -9
  24. data/lib/mongo_mapper/plugins/associations/one_proxy.rb +27 -26
  25. data/lib/mongo_mapper/plugins/associations/proxy.rb +29 -26
  26. data/lib/mongo_mapper/plugins/callbacks.rb +13 -0
  27. data/lib/mongo_mapper/plugins/counter_cache.rb +23 -4
  28. data/lib/mongo_mapper/plugins/dirty.rb +2 -2
  29. data/lib/mongo_mapper/plugins/dynamic_querying.rb +10 -9
  30. data/lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb +17 -16
  31. data/lib/mongo_mapper/plugins/embedded_callbacks.rb +1 -1
  32. data/lib/mongo_mapper/plugins/identity_map.rb +1 -1
  33. data/lib/mongo_mapper/plugins/indexes.rb +1 -1
  34. data/lib/mongo_mapper/plugins/keys.rb +158 -158
  35. data/lib/mongo_mapper/plugins/keys/key.rb +16 -10
  36. data/lib/mongo_mapper/plugins/keys/static.rb +45 -0
  37. data/lib/mongo_mapper/plugins/modifiers.rb +27 -26
  38. data/lib/mongo_mapper/plugins/partial_updates.rb +86 -0
  39. data/lib/mongo_mapper/plugins/persistence.rb +7 -6
  40. data/lib/mongo_mapper/plugins/protected.rb +6 -5
  41. data/lib/mongo_mapper/plugins/querying.rb +80 -43
  42. data/lib/mongo_mapper/plugins/querying/decorated_plucky_query.rb +14 -9
  43. data/lib/mongo_mapper/plugins/scopes.rb +78 -7
  44. data/lib/mongo_mapper/plugins/timestamps.rb +1 -0
  45. data/lib/mongo_mapper/plugins/validations.rb +0 -0
  46. data/lib/mongo_mapper/version.rb +1 -1
  47. data/lib/rails/generators/mongo_mapper/config/config_generator.rb +12 -13
  48. data/lib/rails/generators/mongo_mapper/model/model_generator.rb +9 -9
  49. data/spec/functional/accessible_spec.rb +12 -12
  50. data/spec/functional/associations/belongs_to_polymorphic_proxy_spec.rb +11 -11
  51. data/spec/functional/associations/belongs_to_proxy_spec.rb +14 -15
  52. data/spec/functional/associations/in_array_proxy_spec.rb +6 -6
  53. data/spec/functional/associations/many_documents_proxy_spec.rb +89 -18
  54. data/spec/functional/associations/many_embedded_polymorphic_proxy_spec.rb +11 -11
  55. data/spec/functional/associations/many_embedded_proxy_spec.rb +1 -1
  56. data/spec/functional/associations/one_as_proxy_spec.rb +14 -14
  57. data/spec/functional/associations/one_embedded_polymorphic_proxy_spec.rb +9 -9
  58. data/spec/functional/associations/one_embedded_proxy_spec.rb +3 -3
  59. data/spec/functional/associations/one_proxy_spec.rb +14 -14
  60. data/spec/functional/caching_spec.rb +8 -8
  61. data/spec/functional/callbacks_spec.rb +87 -0
  62. data/spec/functional/counter_cache_spec.rb +89 -0
  63. data/spec/functional/dirty_spec.rb +41 -41
  64. data/spec/functional/document_spec.rb +3 -3
  65. data/spec/functional/embedded_document_spec.rb +18 -18
  66. data/spec/functional/identity_map_spec.rb +28 -15
  67. data/spec/functional/indexes_spec.rb +4 -4
  68. data/spec/functional/keys_spec.rb +12 -3
  69. data/spec/functional/logger_spec.rb +1 -1
  70. data/spec/functional/modifiers_spec.rb +2 -2
  71. data/spec/functional/partial_updates_spec.rb +577 -0
  72. data/spec/functional/protected_spec.rb +13 -13
  73. data/spec/functional/querying_spec.rb +11 -10
  74. data/spec/functional/safe_spec.rb +2 -2
  75. data/spec/functional/sci_spec.rb +3 -3
  76. data/spec/functional/scopes_spec.rb +234 -1
  77. data/spec/functional/static_keys_spec.rb +153 -0
  78. data/spec/functional/stats_spec.rb +0 -4
  79. data/spec/functional/touch_spec.rb +1 -1
  80. data/spec/functional/validations_spec.rb +59 -57
  81. data/spec/quality_spec.rb +1 -1
  82. data/spec/spec_helper.rb +7 -3
  83. data/spec/support/matchers.rb +4 -13
  84. data/spec/unit/associations/base_spec.rb +12 -12
  85. data/spec/unit/associations/belongs_to_association_spec.rb +2 -2
  86. data/spec/unit/associations/many_association_spec.rb +2 -2
  87. data/spec/unit/associations/one_association_spec.rb +2 -2
  88. data/spec/unit/associations/proxy_spec.rb +13 -15
  89. data/spec/unit/document_spec.rb +5 -5
  90. data/spec/unit/dynamic_finder_spec.rb +8 -8
  91. data/spec/unit/embedded_document_spec.rb +14 -14
  92. data/spec/unit/extensions_spec.rb +17 -17
  93. data/spec/unit/identity_map_middleware_spec.rb +5 -5
  94. data/spec/unit/key_spec.rb +24 -21
  95. data/spec/unit/keys_spec.rb +5 -5
  96. data/spec/unit/mongo_mapper_spec.rb +26 -26
  97. data/spec/unit/rails_spec.rb +2 -2
  98. data/spec/unit/serialization_spec.rb +1 -1
  99. data/spec/unit/time_zones_spec.rb +2 -2
  100. data/spec/unit/validations_spec.rb +28 -15
  101. metadata +16 -14
  102. data/lib/mongo_mapper/connections/10gen.rb +0 -0
  103. data/lib/mongo_mapper/connections/moped.rb +0 -0
@@ -9,19 +9,90 @@ module MongoMapper
9
9
  end
10
10
 
11
11
  module ClassMethods
12
- def scope(name, scope_options={})
12
+ def scope(name, scope={})
13
13
  # Assign to _scopes instead of using []= to avoid mixing subclass scopes
14
- self._scopes = scopes.merge(name => lambda do |*args|
15
- result = scope_options.is_a?(Proc) ? scope_options.call(*args) : scope_options
16
- result = self.query(result) if result.is_a?(Hash)
17
- self.query.merge(result)
18
- end)
19
- singleton_class.send :define_method, name, &scopes[name]
14
+ self._scopes = scopes.merge(name => scope)
15
+
16
+ singleton_class.send :define_method, name do |*args|
17
+ process_scope(self, scopes[name], *args)
18
+ end
20
19
  end
21
20
 
22
21
  def scopes
23
22
  self._scopes ||= {}
24
23
  end
24
+
25
+ def active_scopes
26
+ @active_scopes ||= []
27
+ end
28
+
29
+ def default_scopes
30
+ @default_scopes ||= begin
31
+ superclass.respond_to?(:default_scopes) ?
32
+ superclass.default_scopes.dup :
33
+ []
34
+ end
35
+ end
36
+
37
+ def query(options = {})
38
+ res = super(options)
39
+
40
+ all_anonymous_scopes.each do |scope|
41
+ unscoped do
42
+ res = process_scope(res, scope)
43
+ end
44
+ end
45
+
46
+ res
47
+ end
48
+
49
+ def default_scope(*args, &block)
50
+ if block_given?
51
+ default_scopes << instance_exec(&block)
52
+ end
53
+
54
+ if args.any?
55
+ default_scopes << args
56
+ end
57
+
58
+ default_scopes
59
+ end
60
+
61
+ def with_scope(query = {})
62
+ active_scopes.push(query)
63
+ yield
64
+ ensure
65
+ active_scopes.pop
66
+ end
67
+
68
+ def unscoped
69
+ old_default_scopes = default_scopes.dup
70
+ old_active_scopes = active_scopes.dup
71
+
72
+ @default_scopes = []
73
+ @active_scopes = []
74
+
75
+ yield
76
+ ensure
77
+ @default_scopes = old_default_scopes
78
+ @active_scopes = old_active_scopes
79
+ end
80
+
81
+ private
82
+
83
+ def process_scope(context, scope, *args)
84
+ if scope.is_a?(Proc)
85
+ scope = context.instance_exec(*args, &scope)
86
+ end
87
+
88
+ scope.is_a?(Hash) ?
89
+ context.where(scope) :
90
+ scope
91
+ end
92
+
93
+ def all_anonymous_scopes
94
+ [default_scopes + active_scopes].flatten
95
+ end
25
96
  end
26
97
  end
27
98
  end
@@ -23,6 +23,7 @@ module MongoMapper
23
23
  self[:created_at] = now if !persisted? && !created_at?
24
24
  self[:updated_at] = now
25
25
  end
26
+ true
26
27
  end
27
28
  end
28
29
  end
File without changes
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module MongoMapper
3
- Version = '0.13.1'
3
+ Version = '0.14.0.rc1'
4
4
  end
@@ -15,23 +15,22 @@ module MongoMapper
15
15
  template 'mongo.yml', File.join('config', 'mongo.yml')
16
16
  end
17
17
 
18
- protected
18
+ protected
19
19
 
20
- def app_name
21
- @app_name ||= defined_app_const_base? ? defined_app_name : File.basename(destination_root)
22
- end
23
-
24
- def defined_app_name
25
- defined_app_const_base.underscore
26
- end
20
+ def app_name
21
+ @app_name ||= defined_app_const_base? ? defined_app_name : File.basename(destination_root)
22
+ end
27
23
 
28
- def defined_app_const_base
29
- Rails.respond_to?(:application) && defined?(Rails::Application) &&
30
- Rails.application.is_a?(Rails::Application) && Rails.application.class.name.sub(/::Application$/, '')
31
- end
24
+ def defined_app_name
25
+ defined_app_const_base.underscore
26
+ end
32
27
 
33
- alias :defined_app_const_base? :defined_app_const_base
28
+ def defined_app_const_base
29
+ Rails.respond_to?(:application) && defined?(Rails::Application) &&
30
+ Rails.application.is_a?(Rails::Application) && Rails.application.class.name.sub(/::Application$/, '')
31
+ end
34
32
 
33
+ alias :defined_app_const_base? :defined_app_const_base
35
34
  end
36
35
  end
37
36
  end
@@ -23,18 +23,18 @@ module MongoMapper
23
23
 
24
24
  hook_for :test_framework
25
25
 
26
- protected
26
+ protected
27
27
 
28
- def parent_class_name
29
- options[:parent]
30
- end
28
+ def parent_class_name
29
+ options[:parent]
30
+ end
31
31
 
32
- # Rails 3.0.X compatibility
33
- unless methods.include?(:module_namespacing)
34
- def module_namespacing(&block)
35
- yield if block
36
- end
32
+ # Rails 3.0.X compatibility
33
+ unless methods.include?(:module_namespacing)
34
+ def module_namespacing(&block)
35
+ yield if block
37
36
  end
37
+ end
38
38
  end
39
39
  end
40
40
  end
@@ -39,12 +39,12 @@ describe "Accessible" do
39
39
 
40
40
  it "should assign inaccessible attribute through accessor" do
41
41
  @doc.admin = true
42
- @doc.admin.should be_true
42
+ @doc.admin.should be_truthy
43
43
  end
44
44
 
45
45
  it "should ignore inaccessible attribute on #initialize" do
46
46
  doc = @doc_class.new(:name => 'John', :admin => true)
47
- doc.admin.should be_false
47
+ doc.admin.should be_falsey
48
48
  doc.name.should == 'John'
49
49
  end
50
50
 
@@ -54,7 +54,7 @@ describe "Accessible" do
54
54
  doc.save!
55
55
 
56
56
  doc = @doc_class.first(:name => 'John')
57
- doc.admin.should be_true
57
+ doc.admin.should be_truthy
58
58
  doc.name.should == 'John'
59
59
  end
60
60
 
@@ -64,37 +64,37 @@ describe "Accessible" do
64
64
  doc.save!
65
65
 
66
66
  doc.reload
67
- doc.admin.should be_true
67
+ doc.admin.should be_truthy
68
68
  doc.name.should == 'John'
69
69
  end
70
70
 
71
71
  it "should not ignore inaccessible attribute on #update_attribute" do
72
72
  @doc.update_attribute('admin', true)
73
- @doc.admin.should be_true
73
+ @doc.admin.should be_truthy
74
74
  end
75
75
 
76
76
  it "should ignore inaccessible attribute on #update_attributes" do
77
77
  @doc.update_attributes(:name => 'Ren Hoek', :admin => true)
78
78
  @doc.name.should == 'Ren Hoek'
79
- @doc.admin.should be_false
79
+ @doc.admin.should be_falsey
80
80
  end
81
81
 
82
82
  it "should ignore inaccessible attribute on #update_attributes!" do
83
83
  @doc.update_attributes!(:name => 'Stimpson J. Cat', :admin => true)
84
84
  @doc.name.should == 'Stimpson J. Cat'
85
- @doc.admin.should be_false
85
+ @doc.admin.should be_falsey
86
86
  end
87
87
 
88
88
  it "should ignore inaccessible attribute on #attributes=" do
89
89
  @doc.attributes = {:name => 'Ren Hoek', :admin => true}
90
90
  @doc.name.should == 'Ren Hoek'
91
- @doc.admin.should be_false
91
+ @doc.admin.should be_falsey
92
92
  end
93
93
 
94
94
  it "should be indifferent to whether the accessible keys are strings or symbols" do
95
95
  @doc.update_attributes!("name" => 'Stimpson J. Cat', "admin" => true)
96
96
  @doc.name.should == 'Stimpson J. Cat'
97
- @doc.admin.should be_false
97
+ @doc.admin.should be_falsey
98
98
  end
99
99
 
100
100
  it "should accept nil as constructor's argument without raising exception" do
@@ -180,19 +180,19 @@ describe "Accessible" do
180
180
 
181
181
  it "should assign inaccessible attribute through accessor" do
182
182
  @edoc.admin = true
183
- @edoc.admin.should be_true
183
+ @edoc.admin.should be_truthy
184
184
  end
185
185
 
186
186
  it "should ignore inaccessible attribute on #update_attributes" do
187
187
  @edoc.update_attributes(:name => 'Ren Hoek', :admin => true)
188
188
  @edoc.name.should == 'Ren Hoek'
189
- @edoc.admin.should be_false
189
+ @edoc.admin.should be_falsey
190
190
  end
191
191
 
192
192
  it "should ignore inaccessible attribute on #update_attributes!" do
193
193
  @edoc.update_attributes!(:name => 'Stimpson J. Cat', :admin => true)
194
194
  @edoc.name.should == 'Stimpson J. Cat'
195
- @edoc.admin.should be_false
195
+ @edoc.admin.should be_falsey
196
196
  end
197
197
  end
198
198
  end
@@ -9,26 +9,26 @@ describe "BelongsToPolymorphicProxy" do
9
9
 
10
10
  it "should default to nil" do
11
11
  status = Status.new
12
- status.target.nil?.should be_true
12
+ status.target.nil?.should be_truthy
13
13
  status.target.inspect.should == "nil"
14
14
  end
15
15
 
16
16
  it "should have boolean presence method" do
17
17
  status = Status.new
18
- status.target?.should be_false
18
+ status.target?.should be_falsey
19
19
 
20
20
  status.target = Project.new(:name => 'mongomapper')
21
- status.target?.should be_true
21
+ status.target?.should be_truthy
22
22
  end
23
23
 
24
24
  it "should be able to replace the association" do
25
25
  status = Status.new(:name => 'Foo!')
26
26
  project = Project.new(:name => "mongomapper")
27
27
  status.target = project
28
- status.save.should be_true
28
+ status.save.should be_truthy
29
29
 
30
30
  status = status.reload
31
- status.target.nil?.should be_false
31
+ status.target.nil?.should be_falsey
32
32
  status.target_id.should == project._id
33
33
  status.target_type.should == "Project"
34
34
  status.target.name.should == "mongomapper"
@@ -38,13 +38,13 @@ describe "BelongsToPolymorphicProxy" do
38
38
  status = Status.new(:name => 'Foo!')
39
39
  project = Project.new(:name => "mongomapper")
40
40
  status.target = project
41
- status.save.should be_true
41
+ status.save.should be_truthy
42
42
 
43
43
  status = status.reload
44
44
  status.target = nil
45
- status.target_type.nil?.should be_true
46
- status.target_id.nil?.should be_true
47
- status.target.nil?.should be_true
45
+ status.target_type.nil?.should be_truthy
46
+ status.target_id.nil?.should be_truthy
47
+ status.target.nil?.should be_truthy
48
48
  end
49
49
 
50
50
  context "association id set but document not found" do
@@ -52,13 +52,13 @@ describe "BelongsToPolymorphicProxy" do
52
52
  @status = Status.new(:name => 'Foo!')
53
53
  project = Project.new(:name => "mongomapper")
54
54
  @status.target = project
55
- @status.save.should be_true
55
+ @status.save.should be_truthy
56
56
  project.destroy
57
57
  @status.reload
58
58
  end
59
59
 
60
60
  it "should return nil instead of raising error" do
61
- @status.target.nil?.should be_true
61
+ @status.target.nil?.should be_truthy
62
62
  end
63
63
  end
64
64
  end
@@ -1,6 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
-
4
3
  describe "BelongsToProxy" do
5
4
  before do
6
5
  @post_class = Doc()
@@ -11,7 +10,7 @@ describe "BelongsToProxy" do
11
10
  end
12
11
 
13
12
  it "should default to nil" do
14
- @comment_class.new.post.nil?.should be_true
13
+ @comment_class.new.post.nil?.should be_truthy
15
14
  end
16
15
 
17
16
  it "should return nil instead of a proxy" do
@@ -20,10 +19,10 @@ describe "BelongsToProxy" do
20
19
 
21
20
  it "should have boolean presence method" do
22
21
  comment = @comment_class.new(:name => 'Foo!')
23
- comment.post?.should be_false
22
+ comment.post?.should be_falsey
24
23
 
25
24
  comment.post = @post_class.new(:name => 'mongomapper')
26
- comment.post?.should be_true
25
+ comment.post?.should be_truthy
27
26
  end
28
27
 
29
28
  it "should allow overriding association methods" do
@@ -34,19 +33,19 @@ describe "BelongsToProxy" do
34
33
  end
35
34
 
36
35
  instance = @comment_class.new
37
- instance.post?.should be_false
36
+ instance.post?.should be_falsey
38
37
  instance.post = @post_class.new
39
- instance.post?.should be_true
38
+ instance.post?.should be_truthy
40
39
  end
41
40
 
42
41
  it "should be able to replace the association" do
43
42
  post = @post_class.new(:name => 'mongomapper')
44
43
  comment = @comment_class.new(:name => 'Foo!', :post => post)
45
- comment.save.should be_true
44
+ comment.save.should be_truthy
46
45
 
47
46
  comment = comment.reload
48
47
  comment.post.should == post
49
- comment.post.nil?.should be_false
48
+ comment.post.nil?.should be_falsey
50
49
  end
51
50
 
52
51
  it "should not reload the association when replacing" do
@@ -71,12 +70,12 @@ describe "BelongsToProxy" do
71
70
  post2 = @post_class.create(:name => 'post2')
72
71
 
73
72
  comment = @comment_class.new(:name => 'Foo!', :post => post1)
74
- comment.save.should be_true
73
+ comment.save.should be_truthy
75
74
 
76
75
 
77
76
  comment = comment.reload
78
77
  comment.post.should == post1
79
- comment.post.nil?.should be_false
78
+ comment.post.nil?.should be_falsey
80
79
 
81
80
  original_post = comment.post
82
81
  original_post.name.should == 'post1'
@@ -89,23 +88,23 @@ describe "BelongsToProxy" do
89
88
  it "should unset the association" do
90
89
  post = @post_class.new(:name => 'mongomapper')
91
90
  comment = @comment_class.new(:name => 'Foo!', :post => post)
92
- comment.save.should be_true
91
+ comment.save.should be_truthy
93
92
 
94
93
  comment = comment.reload
95
94
  comment.post = nil
96
- comment.post.nil?.should be_true
95
+ comment.post.nil?.should be_truthy
97
96
  end
98
97
 
99
98
  it "should return nil if id set but document not found" do
100
99
  id = BSON::ObjectId.new
101
- @comment_class.new(:name => 'Foo', :post_id => id).post.nil?.should be_true
100
+ @comment_class.new(:name => 'Foo', :post_id => id).post.nil?.should be_truthy
102
101
  end
103
102
 
104
103
  it "should define foreign key if it doesn't exist" do
105
104
  @category_class = Doc()
106
105
  @post_class.belongs_to :category, :class => @category_class
107
106
 
108
- @post_class.key?(:category_id).should be_true
107
+ @post_class.key?(:category_id).should be_truthy
109
108
  end
110
109
 
111
110
  it "should not define foreign key if it already exists" do
@@ -228,7 +227,7 @@ describe "BelongsToProxy" do
228
227
 
229
228
  context 'autosave' do
230
229
  it 'should not be true by default' do
231
- @comment_class.associations[:post].options[:autosave].should_not be_true
230
+ @comment_class.associations[:post].options[:autosave].should_not be_truthy
232
231
  end
233
232
 
234
233
  it 'should save parent changes when true' do
@@ -50,7 +50,7 @@ describe "InArrayProxy" do
50
50
  user = User.new(:name => 'John')
51
51
  list = List.new(:name => 'Foo')
52
52
  user.lists = [list]
53
- user.save.should be_true
53
+ user.save.should be_truthy
54
54
 
55
55
  user.reload
56
56
  user.list_ids.should == [list.id]
@@ -144,7 +144,7 @@ describe "InArrayProxy" do
144
144
 
145
145
  it "should not hit the database if ids key is empty" do
146
146
  @user.list_ids = []
147
- @user.lists.should_receive(:query).never
147
+ expect(@user.lists).to receive(:query).never
148
148
  @user.lists.all.should == []
149
149
  end
150
150
  end
@@ -160,7 +160,7 @@ describe "InArrayProxy" do
160
160
 
161
161
  it "should not hit the database if ids key is empty" do
162
162
  @user.list_ids = []
163
- @user.lists.should_receive(:query).never
163
+ expect(@user.lists).to receive(:query).never
164
164
  @user.lists.first.should be_nil
165
165
  end
166
166
  end
@@ -176,7 +176,7 @@ describe "InArrayProxy" do
176
176
 
177
177
  it "should not hit the database if ids key is empty" do
178
178
  @user.list_ids = []
179
- @user.lists.should_receive(:query).never
179
+ expect(@user.lists).to receive(:query).never
180
180
  @user.lists.last.should be_nil
181
181
  end
182
182
  end
@@ -230,7 +230,7 @@ describe "InArrayProxy" do
230
230
 
231
231
  it "should not hit the database if ids key is empty" do
232
232
  @user.list_ids = []
233
- @user.lists.should_receive(:query).never
233
+ expect(@user.lists).to receive(:query).never
234
234
  @user.lists.paginate(:page => 1).should == []
235
235
  end
236
236
  end
@@ -293,7 +293,7 @@ describe "InArrayProxy" do
293
293
 
294
294
  it "should not hit the database if ids key is empty" do
295
295
  @user.list_ids = []
296
- @user.lists.should_receive(:query).never
296
+ expect(@user.lists).to receive(:query).never
297
297
  @user.lists.count(:name => 'Foo 1').should == 0
298
298
  end
299
299
  end