bullet 4.7.1 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -4,13 +4,13 @@ describe Object do
4
4
  context "bullet_ar_key" do
5
5
  it "should return class and id composition" do
6
6
  post = Post.first
7
- post.bullet_ar_key.should == "Post:#{post.id}"
7
+ expect(post.bullet_ar_key).to eq("Post:#{post.id}")
8
8
  end
9
9
 
10
10
  if mongoid?
11
11
  it "should return class with namesapce and id composition" do
12
12
  post = Mongoid::Post.first
13
- post.bullet_ar_key.should == "Mongoid::Post:#{post.id}"
13
+ expect(post.bullet_ar_key).to eq("Mongoid::Post:#{post.id}")
14
14
  end
15
15
  end
16
16
  end
@@ -3,11 +3,11 @@ require 'spec_helper'
3
3
  describe String do
4
4
  context "bullet_class_name" do
5
5
  it "should only return class name" do
6
- "Post:1".bullet_class_name.should == "Post"
6
+ expect("Post:1".bullet_class_name).to eq("Post")
7
7
  end
8
8
 
9
9
  it "should return class name with namespace" do
10
- "Mongoid::Post:1234567890".bullet_class_name.should == "Mongoid::Post"
10
+ expect("Mongoid::Post:1234567890".bullet_class_name).to eq("Mongoid::Post")
11
11
  end
12
12
  end
13
13
  end
@@ -7,49 +7,54 @@ module Bullet
7
7
 
8
8
  context "#title" do
9
9
  it "should raise NoMethodError" do
10
- lambda { subject.title }.should raise_error(NoMethodError)
10
+ expect { subject.title }.to raise_error(NoMethodError)
11
11
  end
12
12
  end
13
13
 
14
14
  context "#body" do
15
15
  it "should raise NoMethodError" do
16
- lambda { subject.body }.should raise_error(NoMethodError)
16
+ expect { subject.body }.to raise_error(NoMethodError)
17
17
  end
18
18
  end
19
19
 
20
20
  context "#whoami" do
21
21
  it "should display user name" do
22
22
  user = `whoami`.chomp
23
- subject.whoami.should == "user: #{user}"
23
+ expect(subject.whoami).to eq("user: #{user}")
24
24
  end
25
25
  end
26
26
 
27
27
  context "#body_with_caller" do
28
28
  it "should return body" do
29
- subject.stub(:body => "body")
30
- subject.body_with_caller.should == "body"
29
+ allow(subject).to receive(:body).and_return("body")
30
+ expect(subject.body_with_caller).to eq("body")
31
31
  end
32
32
  end
33
33
 
34
34
  context "#standard_notice" do
35
35
  it "should return title + body" do
36
- subject.stub(:title => "title", :body => "body")
37
- subject.standard_notice.should == "title\nbody"
36
+ allow(subject).to receive(:title).and_return("title")
37
+ allow(subject).to receive(:body).and_return("body")
38
+ expect(subject.standard_notice).to eq("title\nbody")
38
39
  end
39
40
  end
40
41
 
41
42
  context "#full_notice" do
42
43
  it "should return whoami + url + title + body_with_caller" do
43
- subject.stub(:whoami => "whoami", :url => "url", :title => "title", :body_with_caller => "body_with_caller")
44
- subject.full_notice.should == "whoami\nurl\ntitle\nbody_with_caller"
44
+ allow(subject).to receive(:whoami).and_return("whoami")
45
+ allow(subject).to receive(:url).and_return("url")
46
+ allow(subject).to receive(:title).and_return("title")
47
+ allow(subject).to receive(:body_with_caller).and_return("body_with_caller")
48
+ expect(subject.full_notice).to eq("whoami\nurl\ntitle\nbody_with_caller")
45
49
  end
46
50
  end
47
51
 
48
52
  context "#notify_inline" do
49
53
  it "should send full_notice to notifier" do
50
54
  notifier = double
51
- subject.stub(:notifier => notifier, :full_notice => "full_notice")
52
- notifier.should_receive(:inline_notify).with("full_notice")
55
+ allow(subject).to receive(:notifier).and_return(notifier)
56
+ allow(subject).to receive(:full_notice).and_return("full_notice")
57
+ expect(notifier).to receive(:inline_notify).with("full_notice")
53
58
  subject.notify_inline
54
59
  end
55
60
  end
@@ -57,8 +62,9 @@ module Bullet
57
62
  context "#notify_out_of_channel" do
58
63
  it "should send full_out_of_channel to notifier" do
59
64
  notifier = double
60
- subject.stub(:notifier => notifier, :full_notice => "full_notice")
61
- notifier.should_receive(:out_of_channel_notify).with("full_notice")
65
+ allow(subject).to receive(:notifier).and_return(notifier)
66
+ allow(subject).to receive(:full_notice).and_return("full_notice")
67
+ expect(notifier).to receive(:out_of_channel_notify).with("full_notice")
62
68
  subject.notify_out_of_channel
63
69
  end
64
70
  end
@@ -5,8 +5,8 @@ module Bullet
5
5
  describe CounterCache do
6
6
  subject { CounterCache.new(Post, [:comments, :votes]) }
7
7
 
8
- its(:body) { should == " Post => [:comments, :votes]" }
9
- its(:title) { should == "Need Counter Cache" }
8
+ it { expect(subject.body).to eq(" Post => [:comments, :votes]") }
9
+ it { expect(subject.title).to eq("Need Counter Cache") }
10
10
  end
11
11
  end
12
12
  end
@@ -5,9 +5,9 @@ module Bullet
5
5
  describe NPlusOneQuery do
6
6
  subject { NPlusOneQuery.new([["caller1", "caller2"]], Post, [:comments, :votes], "path") }
7
7
 
8
- its(:body_with_caller) { should == " Post => [:comments, :votes]\n Add to your finder: :include => [:comments, :votes]\nN+1 Query method call stack\n caller1\n caller2" }
9
- its(:body) { should == " Post => [:comments, :votes]\n Add to your finder: :include => [:comments, :votes]" }
10
- its(:title) { should == "N+1 Query in path" }
8
+ it { expect(subject.body_with_caller).to eq(" Post => [:comments, :votes]\n Add to your finder: :include => [:comments, :votes]\nN+1 Query method call stack\n caller1\n caller2") }
9
+ it { expect(subject.body).to eq(" Post => [:comments, :votes]\n Add to your finder: :include => [:comments, :votes]") }
10
+ it { expect(subject.title).to eq("N+1 Query in path") }
11
11
  end
12
12
  end
13
13
  end
@@ -5,8 +5,8 @@ module Bullet
5
5
  describe UnusedEagerLoading do
6
6
  subject { UnusedEagerLoading.new(Post, [:comments, :votes], "path") }
7
7
 
8
- its(:body) { should == " Post => [:comments, :votes]\n Remove from your finder: :include => [:comments, :votes]" }
9
- its(:title) { should == "Unused Eager Loading in path" }
8
+ it { expect(subject.body).to eq(" Post => [:comments, :votes]\n Remove from your finder: :include => [:comments, :votes]") }
9
+ it { expect(subject.title).to eq("Unused Eager Loading in path") }
10
10
  end
11
11
  end
12
12
  end
@@ -7,25 +7,25 @@ module Bullet
7
7
  context "#add" do
8
8
  it "should add a value" do
9
9
  subject.add("value1")
10
- subject.collection.should be_include("value1")
10
+ expect(subject.collection).to be_include("value1")
11
11
  end
12
12
  end
13
13
 
14
14
  context "#reset" do
15
15
  it "should reset collector" do
16
16
  subject.reset
17
- subject.collection.should be_empty
17
+ expect(subject.collection).to be_empty
18
18
  end
19
19
  end
20
20
 
21
21
  context "#notifications_present?" do
22
22
  it "should be true if collection is not empty" do
23
- subject.should be_notifications_present
23
+ expect(subject).to be_notifications_present
24
24
  end
25
25
 
26
26
  it "should be false if collection is empty" do
27
27
  subject.reset
28
- subject.should_not be_notifications_present
28
+ expect(subject).not_to be_notifications_present
29
29
  end
30
30
  end
31
31
  end
@@ -10,56 +10,56 @@ module Bullet
10
10
  it "should be true if Content-Type is text/html and http body contains html tag" do
11
11
  headers = {"Content-Type" => "text/html"}
12
12
  response = double(:body => "<html><head></head><body></body></html>")
13
- middleware.should be_html_request(headers, response)
13
+ expect(middleware).to be_html_request(headers, response)
14
14
  end
15
15
 
16
16
  it "should be true if Content-Type is text/html and http body contains html tag with attributes" do
17
17
  headers = {"Content-Type" => "text/html"}
18
18
  response = double(:body => "<html attr='hello'><head></head><body></body></html>")
19
- middleware.should be_html_request(headers, response)
19
+ expect(middleware).to be_html_request(headers, response)
20
20
  end
21
21
 
22
22
  it "should be false if there is no Content-Type header" do
23
23
  headers = {}
24
24
  response = double(:body => "<html><head></head><body></body></html>")
25
- middleware.should_not be_html_request(headers, response)
25
+ expect(middleware).not_to be_html_request(headers, response)
26
26
  end
27
27
 
28
28
  it "should be false if Content-Type is javascript" do
29
29
  headers = {"Content-Type" => "text/javascript"}
30
30
  response = double(:body => "<html><head></head><body></body></html>")
31
- middleware.should_not be_html_request(headers, response)
31
+ expect(middleware).not_to be_html_request(headers, response)
32
32
  end
33
33
 
34
34
  it "should be false if response body doesn't contain html tag" do
35
35
  headers = {"Content-Type" => "text/html"}
36
36
  response = double(:body => "<div>Partial</div>")
37
- middleware.should_not be_html_request(headers, response)
37
+ expect(middleware).not_to be_html_request(headers, response)
38
38
  end
39
39
  end
40
40
 
41
41
  context "empty?" do
42
42
  it "should be false if response is a string and not empty" do
43
43
  response = double(:body => "<html><head></head><body></body></html>")
44
- middleware.should_not be_empty(response)
44
+ expect(middleware).not_to be_empty(response)
45
45
  end
46
46
 
47
47
  it "should be true if response is not found" do
48
48
  response = ["Not Found"]
49
- middleware.should be_empty(response)
49
+ expect(middleware).to be_empty(response)
50
50
  end
51
51
 
52
52
  it "should be true if response body is empty" do
53
53
  response = double(:body => "")
54
- middleware.should be_empty(response)
54
+ expect(middleware).to be_empty(response)
55
55
  end
56
56
  end
57
57
 
58
58
  context "#call" do
59
59
  context "when Bullet is enabled" do
60
60
  it "should invoke Bullet.start_request and Bullet.end_request" do
61
- Bullet.should_receive(:start_request)
62
- Bullet.should_receive(:end_request)
61
+ expect(Bullet).to receive(:start_request)
62
+ expect(Bullet).to receive(:end_request)
63
63
  middleware.call([])
64
64
  end
65
65
 
@@ -67,34 +67,34 @@ module Bullet
67
67
  expected_response = Support::ResponseDouble.new "Actual body"
68
68
  app.response = expected_response
69
69
  status, headers, response = middleware.call([])
70
- response.should == expected_response
70
+ expect(response).to eq(expected_response)
71
71
  end
72
72
 
73
73
  it "should change response body if notification is active" do
74
- Bullet.should_receive(:notification?).and_return(true)
75
- Bullet.should_receive(:gather_inline_notifications).and_return("<bullet></bullet>")
76
- Bullet.should_receive(:perform_out_of_channel_notifications)
74
+ expect(Bullet).to receive(:notification?).and_return(true)
75
+ expect(Bullet).to receive(:gather_inline_notifications).and_return("<bullet></bullet>")
76
+ expect(Bullet).to receive(:perform_out_of_channel_notifications)
77
77
  status, headers, response = middleware.call([200, {"Content-Type" => "text/html"}])
78
- headers["Content-Length"].should == "56"
79
- response.should == ["<html><head></head><body></body></html><bullet></bullet>"]
78
+ expect(headers["Content-Length"]).to eq("56")
79
+ expect(response).to eq(["<html><head></head><body></body></html><bullet></bullet>"])
80
80
  end
81
81
 
82
82
  it "should set the right Content-Length if response body contains accents" do
83
83
  response = Support::ResponseDouble.new
84
84
  response.body = "<html><head></head><body>é</body></html>"
85
85
  app.response = response
86
- Bullet.should_receive(:notification?).and_return(true)
87
- Bullet.should_receive(:gather_inline_notifications).and_return("<bullet></bullet>")
86
+ expect(Bullet).to receive(:notification?).and_return(true)
87
+ expect(Bullet).to receive(:gather_inline_notifications).and_return("<bullet></bullet>")
88
88
  status, headers, response = middleware.call([200, {"Content-Type" => "text/html"}])
89
- headers["Content-Length"].should == "58"
89
+ expect(headers["Content-Length"]).to eq("58")
90
90
  end
91
91
  end
92
92
 
93
93
  context "when Bullet is disabled" do
94
- before(:each) { Bullet.stub(:enable? => false) }
94
+ before(:each) { allow(Bullet).to receive(:enable?).and_return(false) }
95
95
 
96
96
  it "should not call Bullet.start_request" do
97
- Bullet.should_not_receive(:start_request)
97
+ expect(Bullet).not_to receive(:start_request)
98
98
  middleware.call([])
99
99
  end
100
100
  end
@@ -8,17 +8,17 @@ module Bullet
8
8
  context "#merge" do
9
9
  it "should merge key/value" do
10
10
  subject.merge("key0", "value0")
11
- subject["key0"].should be_include("value0")
11
+ expect(subject["key0"]).to be_include("value0")
12
12
  end
13
13
  end
14
14
 
15
15
  context "#similarly_associated" do
16
16
  it "should return similarly associated keys" do
17
- subject.similarly_associated("key1", Set.new(["value"])).should == ["key1", "key2"]
17
+ expect(subject.similarly_associated("key1", Set.new(["value"]))).to eq(["key1", "key2"])
18
18
  end
19
19
 
20
20
  it "should return empty if key does not exist" do
21
- subject.similarly_associated("key3", Set.new(["value"])).should be_empty
21
+ expect(subject.similarly_associated("key3", Set.new(["value"]))).to be_empty
22
22
  end
23
23
  end
24
24
  end
@@ -7,36 +7,36 @@ module Bullet
7
7
 
8
8
  context "#[]" do
9
9
  it "should get value by key" do
10
- subject["key"].should == Set.new(["value"])
10
+ expect(subject["key"]).to eq(Set.new(["value"]))
11
11
  end
12
12
  end
13
13
 
14
14
  context "#delete" do
15
15
  it "should delete key" do
16
16
  subject.delete("key")
17
- subject["key"].should be_nil
17
+ expect(subject["key"]).to be_nil
18
18
  end
19
19
  end
20
20
 
21
21
  context "#add" do
22
22
  it "should add value with string" do
23
23
  subject.add("key", "new_value")
24
- subject["key"].should == Set.new(["value", "new_value"])
24
+ expect(subject["key"]).to eq(Set.new(["value", "new_value"]))
25
25
  end
26
26
 
27
27
  it "should add value with array" do
28
28
  subject.add("key", ["value1", "value2"])
29
- subject["key"].should == Set.new(["value", "value1", "value2"])
29
+ expect(subject["key"]).to eq(Set.new(["value", "value1", "value2"]))
30
30
  end
31
31
  end
32
32
 
33
33
  context "#include?" do
34
34
  it "should include key/value" do
35
- subject.include?("key", "value").should be_true
35
+ expect(subject.include?("key", "value")).to eq true
36
36
  end
37
37
 
38
38
  it "should not include wrong key/value" do
39
- subject.include?("key", "val").should be_false
39
+ expect(subject.include?("key", "val")).to eq false
40
40
  end
41
41
  end
42
42
  end
@@ -10,14 +10,14 @@ module Bullet
10
10
 
11
11
  context "#include?" do
12
12
  it "should include the object" do
13
- subject.should be_include(post.bullet_ar_key)
13
+ expect(subject).to be_include(post.bullet_ar_key)
14
14
  end
15
15
  end
16
16
 
17
17
  context "#add" do
18
18
  it "should add an object" do
19
19
  subject.add(another_post.bullet_ar_key)
20
- subject.should be_include(another_post.bullet_ar_key)
20
+ expect(subject).to be_include(another_post.bullet_ar_key)
21
21
  end
22
22
  end
23
23
  end
@@ -17,9 +17,9 @@ if active_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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').all.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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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,17 +373,17 @@ if active_record3?
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
380
380
  # a repeating loop of calls in this test
381
381
  it "should not raise a stack error from posts to category" do
382
- lambda {
382
+ expect {
383
383
  Comment.includes({:post => :category}).each do |com|
384
384
  com.post.category
385
385
  end
386
- }.should_not raise_error(SystemStackError)
386
+ }.not_to raise_error
387
387
  end
388
388
  end
389
389
  end
@@ -404,9 +404,9 @@ if active_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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_record3?
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