bullet 4.7.1 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +17 -17
  4. data/CHANGELOG.md +15 -0
  5. data/Gemfile +9 -2
  6. data/Gemfile.mongoid-2.4 +22 -0
  7. data/Gemfile.mongoid-2.5 +22 -0
  8. data/Gemfile.mongoid-2.6 +22 -0
  9. data/Gemfile.mongoid-2.7 +22 -0
  10. data/Gemfile.mongoid-2.8 +22 -0
  11. data/Gemfile.mongoid-3.0 +22 -0
  12. data/Gemfile.mongoid-3.1 +22 -0
  13. data/Gemfile.rails-3.0 +21 -0
  14. data/Gemfile.rails-3.1 +21 -0
  15. data/Gemfile.rails-3.2 +21 -0
  16. data/Gemfile.rails-4.0 +21 -0
  17. data/{Gemfile.rails-3.0.20 → Gemfile.rails-4.1} +1 -1
  18. data/README.md +24 -23
  19. data/Rakefile +13 -6
  20. data/lib/bullet.rb +1 -1
  21. data/lib/bullet/active_record41.rb +97 -0
  22. data/lib/bullet/dependency.rb +11 -1
  23. data/lib/bullet/mongoid4x.rb +1 -1
  24. data/lib/bullet/registry/base.rb +1 -1
  25. data/lib/bullet/version.rb +1 -1
  26. data/spec/bullet/detector/association_spec.rb +8 -8
  27. data/spec/bullet/detector/base_spec.rb +1 -1
  28. data/spec/bullet/detector/counter_cache_spec.rb +12 -12
  29. data/spec/bullet/detector/n_plus_one_query_spec.rb +32 -32
  30. data/spec/bullet/detector/unused_eager_loading_spec.rb +18 -18
  31. data/spec/bullet/ext/object_spec.rb +2 -2
  32. data/spec/bullet/ext/string_spec.rb +2 -2
  33. data/spec/bullet/notification/base_spec.rb +19 -13
  34. data/spec/bullet/notification/counter_cache_spec.rb +2 -2
  35. data/spec/bullet/notification/n_plus_one_query_spec.rb +3 -3
  36. data/spec/bullet/notification/unused_eager_loading_spec.rb +2 -2
  37. data/spec/bullet/notification_collector_spec.rb +4 -4
  38. data/spec/bullet/rack_spec.rb +21 -21
  39. data/spec/bullet/registry/association_spec.rb +3 -3
  40. data/spec/bullet/registry/base_spec.rb +6 -6
  41. data/spec/bullet/registry/object_spec.rb +2 -2
  42. data/spec/integration/active_record3/association_spec.rb +107 -107
  43. data/spec/integration/active_record4/association_spec.rb +105 -105
  44. data/spec/integration/counter_cache_spec.rb +4 -4
  45. data/spec/integration/mongoid/association_spec.rb +52 -52
  46. data/spec/spec_helper.rb +0 -1
  47. data/test.sh +12 -11
  48. metadata +25 -38
  49. data/.ruby-gemset +0 -1
  50. data/.ruby-version +0 -1
  51. data/Gemfile.lock +0 -160
  52. data/Gemfile.mongoid-2.4.12 +0 -15
  53. data/Gemfile.mongoid-2.4.12.lock +0 -163
  54. data/Gemfile.mongoid-2.5.2 +0 -15
  55. data/Gemfile.mongoid-2.5.2.lock +0 -163
  56. data/Gemfile.mongoid-2.6.0 +0 -15
  57. data/Gemfile.mongoid-2.6.0.lock +0 -163
  58. data/Gemfile.mongoid-2.7.1 +0 -15
  59. data/Gemfile.mongoid-2.7.1.lock +0 -163
  60. data/Gemfile.mongoid-2.8.1 +0 -15
  61. data/Gemfile.mongoid-2.8.1.lock +0 -166
  62. data/Gemfile.mongoid-3.0.23 +0 -15
  63. data/Gemfile.mongoid-3.0.23.lock +0 -163
  64. data/Gemfile.mongoid-3.1.5 +0 -15
  65. data/Gemfile.mongoid-3.1.5.lock +0 -163
  66. data/Gemfile.mongoid.lock +0 -167
  67. data/Gemfile.rails-3.0.20.lock +0 -147
  68. data/Gemfile.rails-3.1.12 +0 -14
  69. data/Gemfile.rails-3.1.12.lock +0 -157
  70. data/Gemfile.rails-3.2.15 +0 -14
  71. data/Gemfile.rails-3.2.15.lock +0 -155
  72. data/Gemfile.rails-4.0.1 +0 -14
  73. data/Gemfile.rails-4.0.1.lock +0 -150
@@ -17,9 +17,9 @@ if active_record4?
17
17
  post.comments.map(&:name)
18
18
  end
19
19
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
20
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
20
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
21
21
 
22
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Post, :comments)
22
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
23
23
  end
24
24
 
25
25
  it "should detect preload with post => comments" do
@@ -27,25 +27,25 @@ if active_record4?
27
27
  post.comments.map(&:name)
28
28
  end
29
29
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
30
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
30
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
31
31
 
32
- Bullet::Detector::Association.should be_completely_preloading_associations
32
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
33
33
  end
34
34
 
35
35
  it "should detect unused preload post => comments" do
36
36
  Post.includes(:comments).map(&:name)
37
37
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
38
- Bullet::Detector::Association.should be_unused_preload_associations_for(Post, :comments)
38
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Post, :comments)
39
39
 
40
- Bullet::Detector::Association.should be_completely_preloading_associations
40
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
41
41
  end
42
42
 
43
43
  it "should not detect unused preload post => comments" do
44
44
  Post.all.map(&:name)
45
45
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
46
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
46
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
47
47
 
48
- Bullet::Detector::Association.should be_completely_preloading_associations
48
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
49
49
  end
50
50
 
51
51
  it "should detect non preload comment => post with inverse_of" do
@@ -56,9 +56,9 @@ if active_record4?
56
56
  end
57
57
  end
58
58
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
59
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
59
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
60
60
 
61
- Bullet::Detector::Association.should be_completely_preloading_associations
61
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
62
62
  end
63
63
  end
64
64
 
@@ -70,10 +70,10 @@ if active_record4?
70
70
  end
71
71
  end
72
72
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
73
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
73
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
74
74
 
75
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Category, :posts)
76
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Post, :comments)
75
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Category, :posts)
76
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
77
77
  end
78
78
 
79
79
  it "should detect preload category => posts, but no post => comments" do
@@ -83,10 +83,10 @@ if active_record4?
83
83
  end
84
84
  end
85
85
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
86
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
86
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
87
87
 
88
- Bullet::Detector::Association.should_not be_detecting_unpreloaded_association_for(Category, :posts)
89
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Post, :comments)
88
+ expect(Bullet::Detector::Association).not_to be_detecting_unpreloaded_association_for(Category, :posts)
89
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
90
90
  end
91
91
 
92
92
  it "should detect preload with category => posts => comments" do
@@ -96,17 +96,17 @@ if active_record4?
96
96
  end
97
97
  end
98
98
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
99
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
99
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
100
100
 
101
- Bullet::Detector::Association.should be_completely_preloading_associations
101
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
102
102
  end
103
103
 
104
104
  it "should detect unused preload with category => posts => comments" do
105
105
  Category.includes({:posts => :comments}).map(&:name)
106
106
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
107
- Bullet::Detector::Association.should be_unused_preload_associations_for(Post, :comments)
107
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Post, :comments)
108
108
 
109
- Bullet::Detector::Association.should be_completely_preloading_associations
109
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
110
110
  end
111
111
 
112
112
  it "should detect unused preload with post => commnets, no category => posts" do
@@ -114,9 +114,9 @@ if active_record4?
114
114
  category.posts.map(&:name)
115
115
  end
116
116
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
117
- Bullet::Detector::Association.should be_unused_preload_associations_for(Post, :comments)
117
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Post, :comments)
118
118
 
119
- Bullet::Detector::Association.should be_completely_preloading_associations
119
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
120
120
  end
121
121
  end
122
122
 
@@ -127,10 +127,10 @@ if active_record4?
127
127
  category.entries.map(&:name)
128
128
  end
129
129
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
130
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
130
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
131
131
 
132
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Category, :posts)
133
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Category, :entries)
132
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Category, :posts)
133
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Category, :entries)
134
134
  end
135
135
 
136
136
  it "should detect preload with category => posts, but not with category => entries" do
@@ -139,10 +139,10 @@ if active_record4?
139
139
  category.entries.map(&:name)
140
140
  end
141
141
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
142
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
142
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
143
143
 
144
- Bullet::Detector::Association.should_not be_detecting_unpreloaded_association_for(Category, :posts)
145
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Category, :entries)
144
+ expect(Bullet::Detector::Association).not_to be_detecting_unpreloaded_association_for(Category, :posts)
145
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Category, :entries)
146
146
  end
147
147
 
148
148
  it "should detect preload with category => [posts, entries]" do
@@ -151,18 +151,18 @@ if active_record4?
151
151
  category.entries.map(&:name)
152
152
  end
153
153
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
154
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
154
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
155
155
 
156
- Bullet::Detector::Association.should be_completely_preloading_associations
156
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
157
157
  end
158
158
 
159
159
  it "should detect unused preload with category => [posts, entries]" do
160
160
  Category.includes([:posts, :entries]).map(&:name)
161
161
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
162
- Bullet::Detector::Association.should be_unused_preload_associations_for(Category, :posts)
163
- Bullet::Detector::Association.should be_unused_preload_associations_for(Category, :entries)
162
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Category, :posts)
163
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Category, :entries)
164
164
 
165
- Bullet::Detector::Association.should be_completely_preloading_associations
165
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
166
166
  end
167
167
 
168
168
  it "should detect unused preload with category => entries, but not with category => posts" do
@@ -170,10 +170,10 @@ if active_record4?
170
170
  category.posts.map(&:name)
171
171
  end
172
172
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
173
- Bullet::Detector::Association.should_not be_unused_preload_associations_for(Category, :posts)
174
- Bullet::Detector::Association.should be_unused_preload_associations_for(Category, :entries)
173
+ expect(Bullet::Detector::Association).not_to be_unused_preload_associations_for(Category, :posts)
174
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Category, :entries)
175
175
 
176
- Bullet::Detector::Association.should be_completely_preloading_associations
176
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
177
177
  end
178
178
  end
179
179
 
@@ -183,17 +183,17 @@ if active_record4?
183
183
  post.comments.first.name
184
184
  end
185
185
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
186
- Bullet::Detector::Association.should_not be_unused_preload_associations_for(Post, :comments)
186
+ expect(Bullet::Detector::Association).not_to be_unused_preload_associations_for(Post, :comments)
187
187
 
188
- Bullet::Detector::Association.should be_completely_preloading_associations
188
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
189
189
  end
190
190
 
191
191
  it "should detect preload with post => commnets" do
192
192
  Post.first.comments.map(&:name)
193
193
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
194
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
194
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
195
195
 
196
- Bullet::Detector::Association.should be_completely_preloading_associations
196
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
197
197
  end
198
198
  end
199
199
 
@@ -205,8 +205,8 @@ if active_record4?
205
205
  post.writer.name
206
206
  end
207
207
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
208
- Bullet::Detector::Association.should_not be_unused_preload_associations_for(Category, :posts)
209
- Bullet::Detector::Association.should_not be_unused_preload_associations_for(Post, :writer)
208
+ expect(Bullet::Detector::Association).not_to be_unused_preload_associations_for(Category, :posts)
209
+ expect(Bullet::Detector::Association).not_to be_unused_preload_associations_for(Post, :writer)
210
210
  end
211
211
  end
212
212
 
@@ -216,17 +216,17 @@ if active_record4?
216
216
  post.category.name
217
217
  end
218
218
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
219
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
219
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
220
220
 
221
- Bullet::Detector::Association.should be_completely_preloading_associations
221
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
222
222
  end
223
223
 
224
224
  it "should not be unused preload post => category" do
225
225
  Post.in_category_name('first').references(:categories).map(&:name)
226
226
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
227
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
227
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
228
228
 
229
- Bullet::Detector::Association.should be_completely_preloading_associations
229
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
230
230
  end
231
231
  end
232
232
 
@@ -236,17 +236,17 @@ if active_record4?
236
236
  post.comments.map(&:name)
237
237
  end
238
238
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
239
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
239
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
240
240
 
241
- Bullet::Detector::Association.should be_completely_preloading_associations
241
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
242
242
  end
243
243
 
244
244
  it "should detect unused preload with scope" do
245
245
  Post.preload_comments.map(&:name)
246
246
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
247
- Bullet::Detector::Association.should be_unused_preload_associations_for(Post, :comments)
247
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Post, :comments)
248
248
 
249
- Bullet::Detector::Association.should be_completely_preloading_associations
249
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
250
250
  end
251
251
  end
252
252
  end
@@ -267,17 +267,17 @@ if active_record4?
267
267
  comment.post.name
268
268
  end
269
269
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
270
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
270
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
271
271
 
272
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Comment, :post)
272
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Comment, :post)
273
273
  end
274
274
 
275
275
  it "should detect preload with one comment => post" do
276
276
  Comment.first.post.name
277
277
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
278
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
278
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
279
279
 
280
- Bullet::Detector::Association.should be_completely_preloading_associations
280
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
281
281
  end
282
282
 
283
283
  it "should dtect preload with comment => post" do
@@ -285,25 +285,25 @@ if active_record4?
285
285
  comment.post.name
286
286
  end
287
287
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
288
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
288
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
289
289
 
290
- Bullet::Detector::Association.should be_completely_preloading_associations
290
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
291
291
  end
292
292
 
293
293
  it "should not detect preload with comment => post" do
294
294
  Comment.all.map(&:name)
295
295
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
296
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
296
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
297
297
 
298
- Bullet::Detector::Association.should be_completely_preloading_associations
298
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
299
299
  end
300
300
 
301
301
  it "should detect unused preload with comments => post" do
302
302
  Comment.includes(:post).map(&:name)
303
303
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
304
- Bullet::Detector::Association.should be_unused_preload_associations_for(Comment, :post)
304
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Comment, :post)
305
305
 
306
- Bullet::Detector::Association.should be_completely_preloading_associations
306
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
307
307
  end
308
308
  end
309
309
 
@@ -313,9 +313,9 @@ if active_record4?
313
313
  comment.post.category.name
314
314
  end
315
315
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
316
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
316
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
317
317
 
318
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Comment, :post)
318
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Comment, :post)
319
319
  end
320
320
 
321
321
  it "should detect non preload association with post => category" do
@@ -323,9 +323,9 @@ if active_record4?
323
323
  comment.post.category.name
324
324
  end
325
325
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
326
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
326
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
327
327
 
328
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Post, :category)
328
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :category)
329
329
  end
330
330
 
331
331
  it "should not detect unpreload association" do
@@ -333,9 +333,9 @@ if active_record4?
333
333
  comment.post.category.name
334
334
  end
335
335
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
336
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
336
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
337
337
 
338
- Bullet::Detector::Association.should be_completely_preloading_associations
338
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
339
339
  end
340
340
  end
341
341
 
@@ -347,9 +347,9 @@ if active_record4?
347
347
  comment.post.writer.name
348
348
  end
349
349
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
350
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
350
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
351
351
 
352
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Post, :writer)
352
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :writer)
353
353
  end
354
354
 
355
355
  # this happens because the comment doesn't break down the hash into keys
@@ -359,9 +359,9 @@ if active_record4?
359
359
  comment.post.writer.name
360
360
  end
361
361
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
362
- Bullet::Detector::Association.should be_unused_preload_associations_for(Comment, :author)
362
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Comment, :author)
363
363
 
364
- Bullet::Detector::Association.should be_completely_preloading_associations
364
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
365
365
  end
366
366
 
367
367
  # To flyerhzm: This does not detect that newspaper is unpreloaded. The association is
@@ -373,7 +373,7 @@ if active_record4?
373
373
  #Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
374
374
  #Bullet::Detector::Association.should_not be_has_unused_preload_associations
375
375
 
376
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Writer, :newspaper)
376
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Writer, :newspaper)
377
377
  end
378
378
 
379
379
  # when we attempt to access category, there is an infinite overflow because load_target is hijacked leading to
@@ -404,9 +404,9 @@ if active_record4?
404
404
  student.teachers.map(&:name)
405
405
  end
406
406
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
407
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
407
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
408
408
 
409
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Student, :teachers)
409
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Student, :teachers)
410
410
  end
411
411
 
412
412
  it "should detect preload associations" do
@@ -414,25 +414,25 @@ if active_record4?
414
414
  student.teachers.map(&:name)
415
415
  end
416
416
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
417
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
417
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
418
418
 
419
- Bullet::Detector::Association.should be_completely_preloading_associations
419
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
420
420
  end
421
421
 
422
422
  it "should detect unused preload associations" do
423
423
  Student.includes(:teachers).map(&:name)
424
424
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
425
- Bullet::Detector::Association.should be_unused_preload_associations_for(Student, :teachers)
425
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Student, :teachers)
426
426
 
427
- Bullet::Detector::Association.should be_completely_preloading_associations
427
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
428
428
  end
429
429
 
430
430
  it "should detect no unused preload associations" do
431
431
  Student.all.map(&:name)
432
432
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
433
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
433
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
434
434
 
435
- Bullet::Detector::Association.should be_completely_preloading_associations
435
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
436
436
  end
437
437
  end
438
438
  end
@@ -453,9 +453,9 @@ if active_record4?
453
453
  firm.clients.map(&:name)
454
454
  end
455
455
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
456
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
456
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
457
457
 
458
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Firm, :clients)
458
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Firm, :clients)
459
459
  end
460
460
 
461
461
  it "should detect preload associations" do
@@ -463,25 +463,25 @@ if active_record4?
463
463
  firm.clients.map(&:name)
464
464
  end
465
465
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
466
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
466
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
467
467
 
468
- Bullet::Detector::Association.should be_completely_preloading_associations
468
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
469
469
  end
470
470
 
471
471
  it "should not detect preload associations" do
472
472
  Firm.all.map(&:name)
473
473
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
474
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
474
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
475
475
 
476
- Bullet::Detector::Association.should be_completely_preloading_associations
476
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
477
477
  end
478
478
 
479
479
  it "should detect unused preload associations" do
480
480
  Firm.includes(:clients).map(&:name)
481
481
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
482
- Bullet::Detector::Association.should be_unused_preload_associations_for(Firm, :clients)
482
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Firm, :clients)
483
483
 
484
- Bullet::Detector::Association.should be_completely_preloading_associations
484
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
485
485
  end
486
486
  end
487
487
  end
@@ -502,9 +502,9 @@ if active_record4?
502
502
  company.address.name
503
503
  end
504
504
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
505
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
505
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
506
506
 
507
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Company, :address)
507
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Company, :address)
508
508
  end
509
509
 
510
510
  it "should detect preload association" do
@@ -512,25 +512,25 @@ if active_record4?
512
512
  company.address.name
513
513
  end
514
514
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
515
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
515
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
516
516
 
517
- Bullet::Detector::Association.should be_completely_preloading_associations
517
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
518
518
  end
519
519
 
520
520
  it "should not detect preload association" do
521
521
  Company.all.map(&:name)
522
522
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
523
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
523
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
524
524
 
525
- Bullet::Detector::Association.should be_completely_preloading_associations
525
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
526
526
  end
527
527
 
528
528
  it "should detect unused preload association" do
529
529
  Company.includes(:address).map(&:name)
530
530
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
531
- Bullet::Detector::Association.should be_unused_preload_associations_for(Company, :address)
531
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Company, :address)
532
532
 
533
- Bullet::Detector::Association.should be_completely_preloading_associations
533
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
534
534
  end
535
535
  end
536
536
  end
@@ -549,9 +549,9 @@ if active_record4?
549
549
  Post.all
550
550
  Post.first.comments.map(&:name)
551
551
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
552
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
552
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
553
553
 
554
- Bullet::Detector::Association.should be_completely_preloading_associations
554
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
555
555
  end
556
556
  end
557
557
 
@@ -571,9 +571,9 @@ if active_record4?
571
571
  page.author.name
572
572
  end
573
573
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
574
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
574
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
575
575
 
576
- Bullet::Detector::Association.should be_detecting_unpreloaded_association_for(Page, :author)
576
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Page, :author)
577
577
  end
578
578
 
579
579
  it "should detect preload associations" do
@@ -581,25 +581,25 @@ if active_record4?
581
581
  page.author.name
582
582
  end
583
583
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
584
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
584
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
585
585
 
586
- Bullet::Detector::Association.should be_completely_preloading_associations
586
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
587
587
  end
588
588
 
589
589
  it "should detect unused preload associations" do
590
590
  Page.includes(:author).map(&:name)
591
591
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
592
- Bullet::Detector::Association.should be_unused_preload_associations_for(Page, :author)
592
+ expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Page, :author)
593
593
 
594
- Bullet::Detector::Association.should be_completely_preloading_associations
594
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
595
595
  end
596
596
 
597
597
  it "should not detect preload associations" do
598
598
  Page.all.map(&:name)
599
599
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
600
- Bullet::Detector::Association.should_not be_has_unused_preload_associations
600
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
601
601
 
602
- Bullet::Detector::Association.should be_completely_preloading_associations
602
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
603
603
  end
604
604
  end
605
605