bullet 5.6.0 → 5.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Guardfile +2 -2
  4. data/Rakefile +16 -16
  5. data/bullet.gemspec +11 -11
  6. data/lib/bullet.rb +3 -3
  7. data/lib/bullet/detector/association.rb +2 -2
  8. data/lib/bullet/detector/counter_cache.rb +3 -3
  9. data/lib/bullet/detector/n_plus_one_query.rb +5 -5
  10. data/lib/bullet/detector/unused_eager_loading.rb +2 -2
  11. data/lib/bullet/ext/string.rb +1 -1
  12. data/lib/bullet/notification/base.rb +6 -6
  13. data/lib/bullet/notification/counter_cache.rb +1 -1
  14. data/lib/bullet/rack.rb +4 -4
  15. data/lib/bullet/stack_trace_filter.rb +2 -2
  16. data/lib/bullet/version.rb +2 -2
  17. data/lib/generators/bullet/install_generator.rb +5 -5
  18. data/perf/benchmark.rb +3 -3
  19. data/spec/bullet/detector/association_spec.rb +4 -4
  20. data/spec/bullet/detector/counter_cache_spec.rb +11 -11
  21. data/spec/bullet/detector/n_plus_one_query_spec.rb +33 -33
  22. data/spec/bullet/detector/unused_eager_loading_spec.rb +19 -19
  23. data/spec/bullet/ext/object_spec.rb +7 -7
  24. data/spec/bullet/ext/string_spec.rb +5 -5
  25. data/spec/bullet/notification/base_spec.rb +32 -32
  26. data/spec/bullet/notification/counter_cache_spec.rb +2 -2
  27. data/spec/bullet/notification/n_plus_one_query_spec.rb +2 -2
  28. data/spec/bullet/notification/unused_eager_loading_spec.rb +2 -2
  29. data/spec/bullet/notification_collector_spec.rb +10 -10
  30. data/spec/bullet/rack_spec.rb +46 -46
  31. data/spec/bullet/registry/association_spec.rb +10 -10
  32. data/spec/bullet/registry/base_spec.rb +20 -20
  33. data/spec/bullet/registry/object_spec.rb +4 -4
  34. data/spec/integration/active_record/association_spec.rb +101 -101
  35. data/spec/integration/counter_cache_spec.rb +12 -12
  36. data/spec/integration/mongoid/association_spec.rb +33 -33
  37. data/spec/models/comment.rb +1 -1
  38. data/spec/models/document.rb +2 -2
  39. data/spec/models/mongoid/address.rb +1 -1
  40. data/spec/models/mongoid/category.rb +2 -2
  41. data/spec/models/mongoid/comment.rb +1 -1
  42. data/spec/models/mongoid/company.rb +1 -1
  43. data/spec/models/mongoid/entry.rb +1 -1
  44. data/spec/models/mongoid/post.rb +3 -3
  45. data/spec/models/newspaper.rb +1 -1
  46. data/spec/spec_helper.rb +12 -12
  47. data/spec/support/mongo_seed.rb +6 -6
  48. data/spec/support/rack_double.rb +2 -2
  49. data/spec/support/sqlite_seed.rb +6 -6
  50. data/tasks/bullet_tasks.rake +2 -2
  51. metadata +2 -2
@@ -5,8 +5,8 @@ module Bullet
5
5
  describe CounterCache do
6
6
  subject { CounterCache.new(Post, [:comments, :votes]) }
7
7
 
8
- it { expect(subject.body).to eq(" Post => [:comments, :votes]") }
9
- it { expect(subject.title).to eq("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
@@ -3,12 +3,12 @@ require 'spec_helper'
3
3
  module Bullet
4
4
  module Notification
5
5
  describe NPlusOneQuery do
6
- subject { NPlusOneQuery.new([["caller1", "caller2"]], Post, [:comments, :votes], "path") }
6
+ subject { NPlusOneQuery.new([['caller1', 'caller2']], Post, [:comments, :votes], 'path') }
7
7
 
8
8
  it { expect(subject.body_with_caller).to eq(" Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]\nCall stack\n caller1\n caller2\n") }
9
9
  it { expect([subject.body_with_caller, subject.body_with_caller]).to eq([ " Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]\nCall stack\n caller1\n caller2\n", " Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]\nCall stack\n caller1\n caller2\n" ]) }
10
10
  it { expect(subject.body).to eq(" Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]") }
11
- it { expect(subject.title).to eq("USE eager loading in path") }
11
+ it { expect(subject.title).to eq('USE eager loading in path') }
12
12
  end
13
13
  end
14
14
  end
@@ -3,10 +3,10 @@ require 'spec_helper'
3
3
  module Bullet
4
4
  module Notification
5
5
  describe UnusedEagerLoading do
6
- subject { UnusedEagerLoading.new([""], Post, [:comments, :votes], "path") }
6
+ subject { UnusedEagerLoading.new([''], Post, [:comments, :votes], 'path') }
7
7
 
8
8
  it { expect(subject.body).to eq(" Post => [:comments, :votes]\n Remove from your finder: :includes => [:comments, :votes]") }
9
- it { expect(subject.title).to eq("AVOID eager loading in path") }
9
+ it { expect(subject.title).to eq('AVOID eager loading in path') }
10
10
  end
11
11
  end
12
12
  end
@@ -2,28 +2,28 @@ require 'spec_helper'
2
2
 
3
3
  module Bullet
4
4
  describe NotificationCollector do
5
- subject { NotificationCollector.new.tap { |collector| collector.add("value") } }
5
+ subject { NotificationCollector.new.tap { |collector| collector.add('value') } }
6
6
 
7
- context "#add" do
8
- it "should add a value" do
9
- subject.add("value1")
10
- expect(subject.collection).to be_include("value1")
7
+ context '#add' do
8
+ it 'should add a value' do
9
+ subject.add('value1')
10
+ expect(subject.collection).to be_include('value1')
11
11
  end
12
12
  end
13
13
 
14
- context "#reset" do
15
- it "should reset collector" do
14
+ context '#reset' do
15
+ it 'should reset collector' do
16
16
  subject.reset
17
17
  expect(subject.collection).to be_empty
18
18
  end
19
19
  end
20
20
 
21
- context "#notifications_present?" do
22
- it "should be true if collection is not empty" do
21
+ context '#notifications_present?' do
22
+ it 'should be true if collection is not empty' do
23
23
  expect(subject).to be_notifications_present
24
24
  end
25
25
 
26
- it "should be false if collection is empty" do
26
+ it 'should be false if collection is empty' do
27
27
  subject.reset
28
28
  expect(subject).not_to be_notifications_present
29
29
  end
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+
2
2
  require 'spec_helper'
3
3
 
4
4
  module Bullet
@@ -6,120 +6,120 @@ module Bullet
6
6
  let(:middleware) { Bullet::Rack.new app }
7
7
  let(:app) { Support::AppDouble.new }
8
8
 
9
- context "#html_request?" do
10
- it "should be true if Content-Type is text/html and http body contains html tag" do
11
- headers = {"Content-Type" => "text/html"}
12
- response = double(:body => "<html><head></head><body></body></html>")
9
+ context '#html_request?' do
10
+ it 'should be true if Content-Type is text/html and http body contains html tag' do
11
+ headers = {'Content-Type' => 'text/html'}
12
+ response = double(:body => '<html><head></head><body></body></html>')
13
13
  expect(middleware).to be_html_request(headers, response)
14
14
  end
15
15
 
16
- it "should be true if Content-Type is text/html and http body contains html tag with attributes" do
17
- headers = {"Content-Type" => "text/html"}
16
+ it 'should be true if Content-Type is text/html and http body contains html tag with attributes' do
17
+ headers = {'Content-Type' => 'text/html'}
18
18
  response = double(:body => "<html attr='hello'><head></head><body></body></html>")
19
19
  expect(middleware).to be_html_request(headers, response)
20
20
  end
21
21
 
22
- it "should be false if there is no Content-Type header" do
22
+ it 'should be false if there is no Content-Type header' do
23
23
  headers = {}
24
- response = double(:body => "<html><head></head><body></body></html>")
24
+ response = double(:body => '<html><head></head><body></body></html>')
25
25
  expect(middleware).not_to be_html_request(headers, response)
26
26
  end
27
27
 
28
- it "should be false if Content-Type is javascript" do
29
- headers = {"Content-Type" => "text/javascript"}
30
- response = double(:body => "<html><head></head><body></body></html>")
28
+ it 'should be false if Content-Type is javascript' do
29
+ headers = {'Content-Type' => 'text/javascript'}
30
+ response = double(:body => '<html><head></head><body></body></html>')
31
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
- headers = {"Content-Type" => "text/html"}
36
- response = double(:body => "<div>Partial</div>")
35
+ headers = {'Content-Type' => 'text/html'}
36
+ response = double(:body => '<div>Partial</div>')
37
37
  expect(middleware).not_to be_html_request(headers, response)
38
38
  end
39
39
  end
40
40
 
41
- context "empty?" do
42
- it "should be false if response is a string and not empty" do
43
- response = double(:body => "<html><head></head><body></body></html>")
41
+ context 'empty?' do
42
+ it 'should be false if response is a string and not empty' do
43
+ response = double(:body => '<html><head></head><body></body></html>')
44
44
  expect(middleware).not_to be_empty(response)
45
45
  end
46
46
 
47
- it "should be true if response is not found" do
48
- response = ["Not Found"]
47
+ it 'should be true if response is not found' do
48
+ response = ['Not Found']
49
49
  expect(middleware).to be_empty(response)
50
50
  end
51
51
 
52
- it "should be true if response body is empty" do
53
- response = double(:body => "")
52
+ it 'should be true if response body is empty' do
53
+ response = double(:body => '')
54
54
  expect(middleware).to be_empty(response)
55
55
  end
56
56
  end
57
57
 
58
- context "#call" do
59
- context "when Bullet is enabled" do
60
- it "should return original response body" do
61
- expected_response = Support::ResponseDouble.new "Actual body"
58
+ context '#call' do
59
+ context 'when Bullet is enabled' do
60
+ it 'should return original response body' do
61
+ expected_response = Support::ResponseDouble.new 'Actual body'
62
62
  app.response = expected_response
63
63
  _, _, response = middleware.call({})
64
64
  expect(response).to eq(expected_response)
65
65
  end
66
66
 
67
- it "should change response body if notification is active" do
67
+ it 'should change response body if notification is active' do
68
68
  expect(Bullet).to receive(:notification?).and_return(true)
69
- expect(Bullet).to receive(:gather_inline_notifications).and_return("<bullet></bullet>")
69
+ expect(Bullet).to receive(:gather_inline_notifications).and_return('<bullet></bullet>')
70
70
  expect(Bullet).to receive(:perform_out_of_channel_notifications)
71
- status, headers, response = middleware.call({"Content-Type" => "text/html"})
72
- expect(headers["Content-Length"]).to eq("56")
73
- expect(response).to eq(["<html><head></head><body><bullet></bullet></body></html>"])
71
+ status, headers, response = middleware.call({'Content-Type' => 'text/html'})
72
+ expect(headers['Content-Length']).to eq('56')
73
+ expect(response).to eq(['<html><head></head><body><bullet></bullet></body></html>'])
74
74
  end
75
75
 
76
- it "should set the right Content-Length if response body contains accents" do
76
+ it 'should set the right Content-Length if response body contains accents' do
77
77
  response = Support::ResponseDouble.new
78
- response.body = "<html><head></head><body>é</body></html>"
78
+ response.body = '<html><head></head><body>é</body></html>'
79
79
  app.response = response
80
80
  expect(Bullet).to receive(:notification?).and_return(true)
81
- expect(Bullet).to receive(:gather_inline_notifications).and_return("<bullet></bullet>")
82
- status, headers, response = middleware.call({"Content-Type" => "text/html"})
83
- expect(headers["Content-Length"]).to eq("58")
81
+ expect(Bullet).to receive(:gather_inline_notifications).and_return('<bullet></bullet>')
82
+ status, headers, response = middleware.call({'Content-Type' => 'text/html'})
83
+ expect(headers['Content-Length']).to eq('58')
84
84
  end
85
85
  end
86
86
 
87
- context "when Bullet is disabled" do
87
+ context 'when Bullet is disabled' do
88
88
  before(:each) { allow(Bullet).to receive(:enable?).and_return(false) }
89
89
 
90
- it "should not call Bullet.start_request" do
90
+ it 'should not call Bullet.start_request' do
91
91
  expect(Bullet).not_to receive(:start_request)
92
92
  middleware.call({})
93
93
  end
94
94
  end
95
95
  end
96
96
 
97
- describe "#response_body" do
97
+ describe '#response_body' do
98
98
  let(:response) { double }
99
- let(:body_string) { "<html><body>My Body</body></html>" }
99
+ let(:body_string) { '<html><body>My Body</body></html>' }
100
100
 
101
- context "when `response` responds to `body`" do
101
+ context 'when `response` responds to `body`' do
102
102
  before { allow(response).to receive(:body).and_return(body) }
103
103
 
104
- context "when `body` returns an Array" do
104
+ context 'when `body` returns an Array' do
105
105
  let(:body) { [body_string, 'random string'] }
106
- it "should return the plain body string" do
106
+ it 'should return the plain body string' do
107
107
  expect(middleware.response_body(response)).to eq body_string
108
108
  end
109
109
  end
110
110
 
111
- context "when `body` does not return an Array" do
111
+ context 'when `body` does not return an Array' do
112
112
  let(:body) { body_string }
113
- it "should return the plain body string" do
113
+ it 'should return the plain body string' do
114
114
  expect(middleware.response_body(response)).to eq body_string
115
115
  end
116
116
  end
117
117
  end
118
118
 
119
- context "when `response` does not respond to `body`" do
119
+ context 'when `response` does not respond to `body`' do
120
120
  before { allow(response).to receive(:first).and_return(body_string) }
121
121
 
122
- it "should return the plain body string" do
122
+ it 'should return the plain body string' do
123
123
  expect(middleware.response_body(response)).to eq body_string
124
124
  end
125
125
  end
@@ -3,22 +3,22 @@ require 'spec_helper'
3
3
  module Bullet
4
4
  module Registry
5
5
  describe Association do
6
- subject { Association.new.tap { |association| association.add(["key1", "key2"], "value") } }
6
+ subject { Association.new.tap { |association| association.add(['key1', 'key2'], 'value') } }
7
7
 
8
- context "#merge" do
9
- it "should merge key/value" do
10
- subject.merge("key0", "value0")
11
- expect(subject["key0"]).to be_include("value0")
8
+ context '#merge' do
9
+ it 'should merge key/value' do
10
+ subject.merge('key0', 'value0')
11
+ expect(subject['key0']).to be_include('value0')
12
12
  end
13
13
  end
14
14
 
15
- context "#similarly_associated" do
16
- it "should return similarly associated keys" do
17
- expect(subject.similarly_associated("key1", Set.new(["value"]))).to eq(["key1", "key2"])
15
+ context '#similarly_associated' do
16
+ it 'should return similarly associated keys' do
17
+ expect(subject.similarly_associated('key1', Set.new(['value']))).to eq(['key1', 'key2'])
18
18
  end
19
19
 
20
- it "should return empty if key does not exist" do
21
- expect(subject.similarly_associated("key3", Set.new(["value"]))).to be_empty
20
+ it 'should return empty if key does not exist' do
21
+ expect(subject.similarly_associated('key3', Set.new(['value']))).to be_empty
22
22
  end
23
23
  end
24
24
  end
@@ -3,40 +3,40 @@ require 'spec_helper'
3
3
  module Bullet
4
4
  module Registry
5
5
  describe Base do
6
- subject { Base.new.tap { |base| base.add("key", "value") } }
6
+ subject { Base.new.tap { |base| base.add('key', 'value') } }
7
7
 
8
- context "#[]" do
9
- it "should get value by key" do
10
- expect(subject["key"]).to eq(Set.new(["value"]))
8
+ context '#[]' do
9
+ it 'should get value by key' do
10
+ expect(subject['key']).to eq(Set.new(['value']))
11
11
  end
12
12
  end
13
13
 
14
- context "#delete" do
15
- it "should delete key" do
16
- subject.delete("key")
17
- expect(subject["key"]).to be_nil
14
+ context '#delete' do
15
+ it 'should delete key' do
16
+ subject.delete('key')
17
+ expect(subject['key']).to be_nil
18
18
  end
19
19
  end
20
20
 
21
- context "#add" do
22
- it "should add value with string" do
23
- subject.add("key", "new_value")
24
- expect(subject["key"]).to eq(Set.new(["value", "new_value"]))
21
+ context '#add' do
22
+ it 'should add value with string' do
23
+ subject.add('key', 'new_value')
24
+ expect(subject['key']).to eq(Set.new(['value', 'new_value']))
25
25
  end
26
26
 
27
- it "should add value with array" do
28
- subject.add("key", ["value1", "value2"])
29
- expect(subject["key"]).to eq(Set.new(["value", "value1", "value2"]))
27
+ it 'should add value with array' do
28
+ subject.add('key', ['value1', 'value2'])
29
+ expect(subject['key']).to eq(Set.new(['value', 'value1', 'value2']))
30
30
  end
31
31
  end
32
32
 
33
- context "#include?" do
34
- it "should include key/value" do
35
- expect(subject.include?("key", "value")).to eq true
33
+ context '#include?' do
34
+ it 'should include key/value' do
35
+ expect(subject.include?('key', 'value')).to eq true
36
36
  end
37
37
 
38
- it "should not include wrong key/value" do
39
- expect(subject.include?("key", "val")).to eq false
38
+ it 'should not include wrong key/value' do
39
+ expect(subject.include?('key', 'val')).to eq false
40
40
  end
41
41
  end
42
42
  end
@@ -7,14 +7,14 @@ module Bullet
7
7
  let(:another_post) { Post.last }
8
8
  subject { Object.new.tap { |object| object.add(post.bullet_key) } }
9
9
 
10
- context "#include?" do
11
- it "should include the object" do
10
+ context '#include?' do
11
+ it 'should include the object' do
12
12
  expect(subject).to be_include(post.bullet_key)
13
13
  end
14
14
  end
15
15
 
16
- context "#add" do
17
- it "should add an object" do
16
+ context '#add' do
17
+ it 'should add an object' do
18
18
  subject.add(another_post.bullet_key)
19
19
  expect(subject).to be_include(another_post.bullet_key)
20
20
  end
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  if active_record?
4
4
  describe Bullet::Detector::Association, 'has_many' do
5
- context "post => comments" do
6
- it "should detect non preload post => comments" do
5
+ context 'post => comments' do
6
+ it 'should detect non preload post => comments' do
7
7
  Post.all.each do |post|
8
8
  post.comments.map(&:name)
9
9
  end
@@ -13,8 +13,8 @@ if active_record?
13
13
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
14
14
  end
15
15
 
16
- it "should detect non preload post => comments for find_by_sql" do
17
- Post.find_by_sql("SELECT * FROM posts").each do |post|
16
+ it 'should detect non preload post => comments for find_by_sql' do
17
+ Post.find_by_sql('SELECT * FROM posts').each do |post|
18
18
  post.comments.map(&:name)
19
19
  end
20
20
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
@@ -23,7 +23,7 @@ if active_record?
23
23
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
24
24
  end
25
25
 
26
- it "should detect preload with post => comments" do
26
+ it 'should detect preload with post => comments' do
27
27
  Post.includes(:comments).each do |post|
28
28
  post.comments.map(&:name)
29
29
  end
@@ -33,7 +33,7 @@ if active_record?
33
33
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
34
34
  end
35
35
 
36
- it "should detect unused preload post => comments" do
36
+ it 'should detect unused preload post => comments' do
37
37
  Post.includes(:comments).map(&:name)
38
38
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
39
39
  expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Post, :comments)
@@ -41,7 +41,7 @@ if active_record?
41
41
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
42
42
  end
43
43
 
44
- it "should not detect unused preload post => comments" do
44
+ it 'should not detect unused preload post => comments' do
45
45
  Post.all.map(&:name)
46
46
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
47
47
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
@@ -49,7 +49,7 @@ if active_record?
49
49
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
50
50
  end
51
51
 
52
- it "should detect non preload comment => post with inverse_of" do
52
+ it 'should detect non preload comment => post with inverse_of' do
53
53
  Post.includes(:comments).each do |post|
54
54
  post.comments.each do |comment|
55
55
  comment.name
@@ -62,7 +62,7 @@ if active_record?
62
62
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
63
63
  end
64
64
 
65
- it "should detect non preload post => comments with empty?" do
65
+ it 'should detect non preload post => comments with empty?' do
66
66
  Post.all.each do |post|
67
67
  post.comments.empty?
68
68
  end
@@ -72,7 +72,7 @@ if active_record?
72
72
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
73
73
  end
74
74
 
75
- it "should detect non preload post => comments with include?" do
75
+ it 'should detect non preload post => comments with include?' do
76
76
  comment = Comment.last
77
77
  Post.all.each do |post|
78
78
  post.comments.include?(comment)
@@ -83,7 +83,7 @@ if active_record?
83
83
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
84
84
  end
85
85
 
86
- it "should not detect unused preload person => pets with empty?" do
86
+ it 'should not detect unused preload person => pets with empty?' do
87
87
  Person.all.each do |person|
88
88
  person.pets.empty?
89
89
  end
@@ -94,8 +94,8 @@ if active_record?
94
94
  end
95
95
  end
96
96
 
97
- context "category => posts => comments" do
98
- it "should detect non preload category => posts => comments" do
97
+ context 'category => posts => comments' do
98
+ it 'should detect non preload category => posts => comments' do
99
99
  Category.all.each do |category|
100
100
  category.posts.each do |post|
101
101
  post.comments.map(&:name)
@@ -108,7 +108,7 @@ if active_record?
108
108
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
109
109
  end
110
110
 
111
- it "should detect preload category => posts, but no post => comments" do
111
+ it 'should detect preload category => posts, but no post => comments' do
112
112
  Category.includes(:posts).each do |category|
113
113
  category.posts.each do |post|
114
114
  post.comments.map(&:name)
@@ -121,7 +121,7 @@ if active_record?
121
121
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
122
122
  end
123
123
 
124
- it "should detect preload with category => posts => comments" do
124
+ it 'should detect preload with category => posts => comments' do
125
125
  Category.includes({:posts => :comments}).each do |category|
126
126
  category.posts.each do |post|
127
127
  post.comments.map(&:name)
@@ -133,7 +133,7 @@ if active_record?
133
133
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
134
134
  end
135
135
 
136
- it "should detect preload with category => posts => comments with posts.id > 0" do
136
+ it 'should detect preload with category => posts => comments with posts.id > 0' do
137
137
  Category.includes({:posts => :comments}).where('posts.id > 0').references(:posts).each do |category|
138
138
  category.posts.each do |post|
139
139
  post.comments.map(&:name)
@@ -145,7 +145,7 @@ if active_record?
145
145
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
146
146
  end
147
147
 
148
- it "should detect unused preload with category => posts => comments" do
148
+ it 'should detect unused preload with category => posts => comments' do
149
149
  Category.includes({:posts => :comments}).map(&:name)
150
150
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
151
151
  expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Post, :comments)
@@ -153,7 +153,7 @@ if active_record?
153
153
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
154
154
  end
155
155
 
156
- it "should detect unused preload with post => commnets, no category => posts" do
156
+ it 'should detect unused preload with post => commnets, no category => posts' do
157
157
  Category.includes({:posts => :comments}).each do |category|
158
158
  category.posts.map(&:name)
159
159
  end
@@ -164,8 +164,8 @@ if active_record?
164
164
  end
165
165
  end
166
166
 
167
- context "category => posts, category => entries" do
168
- it "should detect non preload with category => [posts, entries]" do
167
+ context 'category => posts, category => entries' do
168
+ it 'should detect non preload with category => [posts, entries]' do
169
169
  Category.all.each do |category|
170
170
  category.posts.map(&:name)
171
171
  category.entries.map(&:name)
@@ -177,7 +177,7 @@ if active_record?
177
177
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Category, :entries)
178
178
  end
179
179
 
180
- it "should detect preload with category => posts, but not with category => entries" do
180
+ it 'should detect preload with category => posts, but not with category => entries' do
181
181
  Category.includes(:posts).each do |category|
182
182
  category.posts.map(&:name)
183
183
  category.entries.map(&:name)
@@ -189,7 +189,7 @@ if active_record?
189
189
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Category, :entries)
190
190
  end
191
191
 
192
- it "should detect preload with category => [posts, entries]" do
192
+ it 'should detect preload with category => [posts, entries]' do
193
193
  Category.includes([:posts, :entries]).each do |category|
194
194
  category.posts.map(&:name)
195
195
  category.entries.map(&:name)
@@ -200,7 +200,7 @@ if active_record?
200
200
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
201
201
  end
202
202
 
203
- it "should detect unused preload with category => [posts, entries]" do
203
+ it 'should detect unused preload with category => [posts, entries]' do
204
204
  Category.includes([:posts, :entries]).map(&:name)
205
205
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
206
206
  expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Category, :posts)
@@ -209,7 +209,7 @@ if active_record?
209
209
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
210
210
  end
211
211
 
212
- it "should detect unused preload with category => entries, but not with category => posts" do
212
+ it 'should detect unused preload with category => entries, but not with category => posts' do
213
213
  Category.includes([:posts, :entries]).each do |category|
214
214
  category.posts.map(&:name)
215
215
  end
@@ -221,8 +221,8 @@ if active_record?
221
221
  end
222
222
  end
223
223
 
224
- context "post => comment" do
225
- it "should detect unused preload with post => comments" do
224
+ context 'post => comment' do
225
+ it 'should detect unused preload with post => comments' do
226
226
  Post.includes(:comments).each do |post|
227
227
  post.comments.first.name if post.comments.first
228
228
  end
@@ -232,7 +232,7 @@ if active_record?
232
232
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
233
233
  end
234
234
 
235
- it "should detect preload with post => commnets" do
235
+ it 'should detect preload with post => commnets' do
236
236
  Post.first.comments.map(&:name)
237
237
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
238
238
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
@@ -240,7 +240,7 @@ if active_record?
240
240
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
241
241
  end
242
242
 
243
- it "should not detect unused preload with category => posts" do
243
+ it 'should not detect unused preload with category => posts' do
244
244
  category = Category.first
245
245
  category.draft_post.destroy!
246
246
  post = category.draft_post
@@ -255,9 +255,9 @@ if active_record?
255
255
  end
256
256
  end
257
257
 
258
- context "category => posts => writer" do
259
- it "should not detect unused preload associations" do
260
- category = Category.includes({:posts => :writer}).order("id DESC").find_by_name('first')
258
+ context 'category => posts => writer' do
259
+ it 'should not detect unused preload associations' do
260
+ category = Category.includes({:posts => :writer}).order('id DESC').find_by_name('first')
261
261
  category.posts.map do |post|
262
262
  post.name
263
263
  post.writer.name
@@ -268,8 +268,8 @@ if active_record?
268
268
  end
269
269
  end
270
270
 
271
- context "scope for_category_name" do
272
- it "should detect preload with post => category" do
271
+ context 'scope for_category_name' do
272
+ it 'should detect preload with post => category' do
273
273
  Post.in_category_name('first').references(:categories).each do |post|
274
274
  post.category.name
275
275
  end
@@ -279,7 +279,7 @@ if active_record?
279
279
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
280
280
  end
281
281
 
282
- it "should not be unused preload post => category" do
282
+ it 'should not be unused preload post => category' do
283
283
  Post.in_category_name('first').references(:categories).map(&:name)
284
284
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
285
285
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
@@ -288,8 +288,8 @@ if active_record?
288
288
  end
289
289
  end
290
290
 
291
- context "scope preload_comments" do
292
- it "should detect preload post => comments with scope" do
291
+ context 'scope preload_comments' do
292
+ it 'should detect preload post => comments with scope' do
293
293
  Post.preload_comments.each do |post|
294
294
  post.comments.map(&:name)
295
295
  end
@@ -299,7 +299,7 @@ if active_record?
299
299
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
300
300
  end
301
301
 
302
- it "should detect unused preload with scope" do
302
+ it 'should detect unused preload with scope' do
303
303
  Post.preload_comments.map(&:name)
304
304
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
305
305
  expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Post, :comments)
@@ -310,8 +310,8 @@ if active_record?
310
310
  end
311
311
 
312
312
  describe Bullet::Detector::Association, 'belongs_to' do
313
- context "comment => post" do
314
- it "should detect non preload with comment => post" do
313
+ context 'comment => post' do
314
+ it 'should detect non preload with comment => post' do
315
315
  Comment.all.each do |comment|
316
316
  comment.post.name
317
317
  end
@@ -321,7 +321,7 @@ if active_record?
321
321
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Comment, :post)
322
322
  end
323
323
 
324
- it "should detect preload with one comment => post" do
324
+ it 'should detect preload with one comment => post' do
325
325
  Comment.first.post.name
326
326
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
327
327
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
@@ -329,7 +329,7 @@ if active_record?
329
329
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
330
330
  end
331
331
 
332
- it "should dtect preload with comment => post" do
332
+ it 'should dtect preload with comment => post' do
333
333
  Comment.includes(:post).each do |comment|
334
334
  comment.post.name
335
335
  end
@@ -339,7 +339,7 @@ if active_record?
339
339
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
340
340
  end
341
341
 
342
- it "should not detect preload with comment => post" do
342
+ it 'should not detect preload with comment => post' do
343
343
  Comment.all.map(&:name)
344
344
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
345
345
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
@@ -347,7 +347,7 @@ if active_record?
347
347
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
348
348
  end
349
349
 
350
- it "should detect unused preload with comment => post" do
350
+ it 'should detect unused preload with comment => post' do
351
351
  Comment.includes(:post).map(&:name)
352
352
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
353
353
  expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Comment, :post)
@@ -356,8 +356,8 @@ if active_record?
356
356
  end
357
357
  end
358
358
 
359
- context "comment => post => category" do
360
- it "should detect non preload association with comment => post" do
359
+ context 'comment => post => category' do
360
+ it 'should detect non preload association with comment => post' do
361
361
  Comment.all.each do |comment|
362
362
  comment.post.category.name
363
363
  end
@@ -367,7 +367,7 @@ if active_record?
367
367
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Comment, :post)
368
368
  end
369
369
 
370
- it "should not detect non preload association with only one comment" do
370
+ it 'should not detect non preload association with only one comment' do
371
371
  Comment.first.post.category.name
372
372
 
373
373
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
@@ -376,7 +376,7 @@ if active_record?
376
376
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
377
377
  end
378
378
 
379
- it "should detect non preload association with post => category" do
379
+ it 'should detect non preload association with post => category' do
380
380
  Comment.includes(:post).each do |comment|
381
381
  comment.post.category.name
382
382
  end
@@ -386,7 +386,7 @@ if active_record?
386
386
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :category)
387
387
  end
388
388
 
389
- it "should not detect unpreload association" do
389
+ it 'should not detect unpreload association' do
390
390
  Comment.includes(:post => :category).each do |comment|
391
391
  comment.post.category.name
392
392
  end
@@ -397,9 +397,9 @@ if active_record?
397
397
  end
398
398
  end
399
399
 
400
- context "comment => author, post => writer" do
401
- it "should detect non preloaded writer" do
402
- Comment.includes([:author, :post]).where(["base_users.id = ?", BaseUser.first]).references(:base_users).each do |comment|
400
+ context 'comment => author, post => writer' do
401
+ it 'should detect non preloaded writer' do
402
+ Comment.includes([:author, :post]).where(['base_users.id = ?', BaseUser.first]).references(:base_users).each do |comment|
403
403
  comment.post.writer.name
404
404
  end
405
405
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
@@ -408,8 +408,8 @@ if active_record?
408
408
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :writer)
409
409
  end
410
410
 
411
- it "should detect unused preload with comment => author" do
412
- Comment.includes([:author, {:post => :writer}]).where(["base_users.id = ?", BaseUser.first]).references(:base_users).each do |comment|
411
+ it 'should detect unused preload with comment => author' do
412
+ Comment.includes([:author, {:post => :writer}]).where(['base_users.id = ?', BaseUser.first]).references(:base_users).each do |comment|
413
413
  comment.post.writer.name
414
414
  end
415
415
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
@@ -418,7 +418,7 @@ if active_record?
418
418
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
419
419
  end
420
420
 
421
- it "should detect non preloading with writer => newspaper" do
421
+ it 'should detect non preloading with writer => newspaper' do
422
422
  Comment.includes(:post => :writer).where("posts.name like '%first%'").references(:posts).each do |comment|
423
423
  comment.post.writer.newspaper.name
424
424
  end
@@ -428,7 +428,7 @@ if active_record?
428
428
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Writer, :newspaper)
429
429
  end
430
430
 
431
- it "should not raise a stack error from posts to category" do
431
+ it 'should not raise a stack error from posts to category' do
432
432
  expect {
433
433
  Comment.includes({:post => :category}).each do |com|
434
434
  com.post.category
@@ -439,8 +439,8 @@ if active_record?
439
439
  end
440
440
 
441
441
  describe Bullet::Detector::Association, 'has_and_belongs_to_many' do
442
- context "students <=> teachers" do
443
- it "should detect non preload associations" do
442
+ context 'students <=> teachers' do
443
+ it 'should detect non preload associations' do
444
444
  Student.all.each do |student|
445
445
  student.teachers.map(&:name)
446
446
  end
@@ -450,7 +450,7 @@ if active_record?
450
450
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Student, :teachers)
451
451
  end
452
452
 
453
- it "should detect preload associations" do
453
+ it 'should detect preload associations' do
454
454
  Student.includes(:teachers).each do |student|
455
455
  student.teachers.map(&:name)
456
456
  end
@@ -460,7 +460,7 @@ if active_record?
460
460
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
461
461
  end
462
462
 
463
- it "should detect unused preload associations" do
463
+ it 'should detect unused preload associations' do
464
464
  Student.includes(:teachers).map(&:name)
465
465
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
466
466
  expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Student, :teachers)
@@ -468,7 +468,7 @@ if active_record?
468
468
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
469
469
  end
470
470
 
471
- it "should detect no unused preload associations" do
471
+ it 'should detect no unused preload associations' do
472
472
  Student.all.map(&:name)
473
473
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
474
474
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
@@ -476,7 +476,7 @@ if active_record?
476
476
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
477
477
  end
478
478
 
479
- it "should detect non preload student => teachers with empty?" do
479
+ it 'should detect non preload student => teachers with empty?' do
480
480
  Student.all.each do |student|
481
481
  student.teachers.empty?
482
482
  end
@@ -489,8 +489,8 @@ if active_record?
489
489
  end
490
490
 
491
491
  describe Bullet::Detector::Association, 'has_many :through' do
492
- context "firm => clients" do
493
- it "should detect non preload associations" do
492
+ context 'firm => clients' do
493
+ it 'should detect non preload associations' do
494
494
  Firm.all.each do |firm|
495
495
  firm.clients.map(&:name)
496
496
  end
@@ -500,7 +500,7 @@ if active_record?
500
500
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Firm, :clients)
501
501
  end
502
502
 
503
- it "should detect preload associations" do
503
+ it 'should detect preload associations' do
504
504
  Firm.includes(:clients).each do |firm|
505
505
  firm.clients.map(&:name)
506
506
  end
@@ -510,7 +510,7 @@ if active_record?
510
510
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
511
511
  end
512
512
 
513
- it "should not detect preload associations" do
513
+ it 'should not detect preload associations' do
514
514
  Firm.all.map(&:name)
515
515
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
516
516
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
@@ -518,7 +518,7 @@ if active_record?
518
518
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
519
519
  end
520
520
 
521
- it "should detect unused preload associations" do
521
+ it 'should detect unused preload associations' do
522
522
  Firm.includes(:clients).map(&:name)
523
523
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
524
524
  expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Firm, :clients)
@@ -528,9 +528,9 @@ if active_record?
528
528
  end
529
529
  end
530
530
 
531
- describe Bullet::Detector::Association, "has_one" do
532
- context "company => address" do
533
- it "should detect non preload association" do
531
+ describe Bullet::Detector::Association, 'has_one' do
532
+ context 'company => address' do
533
+ it 'should detect non preload association' do
534
534
  Company.all.each do |company|
535
535
  company.address.name
536
536
  end
@@ -540,7 +540,7 @@ if active_record?
540
540
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Company, :address)
541
541
  end
542
542
 
543
- it "should detect preload association" do
543
+ it 'should detect preload association' do
544
544
  Company.includes(:address).each do |company|
545
545
  company.address.name
546
546
  end
@@ -550,7 +550,7 @@ if active_record?
550
550
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
551
551
  end
552
552
 
553
- it "should not detect preload association" do
553
+ it 'should not detect preload association' do
554
554
  Company.all.map(&:name)
555
555
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
556
556
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
@@ -558,7 +558,7 @@ if active_record?
558
558
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
559
559
  end
560
560
 
561
- it "should detect unused preload association" do
561
+ it 'should detect unused preload association' do
562
562
  Company.includes(:address).map(&:name)
563
563
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
564
564
  expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Company, :address)
@@ -568,8 +568,8 @@ if active_record?
568
568
  end
569
569
  end
570
570
 
571
- describe Bullet::Detector::Association, "has_one => has_many" do
572
- it "should not detect preload association" do
571
+ describe Bullet::Detector::Association, 'has_one => has_many' do
572
+ it 'should not detect preload association' do
573
573
  user = User.first
574
574
  user.submission.replies.map(&:name)
575
575
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
@@ -579,8 +579,8 @@ if active_record?
579
579
  end
580
580
  end
581
581
 
582
- describe Bullet::Detector::Association, "call one association that in possible objects" do
583
- it "should not detect preload association" do
582
+ describe Bullet::Detector::Association, 'call one association that in possible objects' do
583
+ it 'should not detect preload association' do
584
584
  Post.all
585
585
  Post.first.comments.map(&:name)
586
586
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
@@ -590,9 +590,9 @@ if active_record?
590
590
  end
591
591
  end
592
592
 
593
- describe Bullet::Detector::Association, "query immediately after creation" do
594
- context "with save" do
595
- context "document => children" do
593
+ describe Bullet::Detector::Association, 'query immediately after creation' do
594
+ context 'with save' do
595
+ context 'document => children' do
596
596
  it 'should not detect non preload associations' do
597
597
  document1 = Document.new
598
598
  document1.children.build
@@ -612,8 +612,8 @@ if active_record?
612
612
  end
613
613
  end
614
614
 
615
- context "with save!" do
616
- context "document => children" do
615
+ context 'with save!' do
616
+ context 'document => children' do
617
617
  it 'should not detect non preload associations' do
618
618
  document1 = Document.new
619
619
  document1.children.build
@@ -634,9 +634,9 @@ if active_record?
634
634
  end
635
635
  end
636
636
 
637
- describe Bullet::Detector::Association, "STI" do
638
- context "page => author" do
639
- it "should detect non preload associations" do
637
+ describe Bullet::Detector::Association, 'STI' do
638
+ context 'page => author' do
639
+ it 'should detect non preload associations' do
640
640
  Page.all.each do |page|
641
641
  page.author.name
642
642
  end
@@ -646,7 +646,7 @@ if active_record?
646
646
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Page, :author)
647
647
  end
648
648
 
649
- it "should detect preload associations" do
649
+ it 'should detect preload associations' do
650
650
  Page.includes(:author).each do |page|
651
651
  page.author.name
652
652
  end
@@ -656,7 +656,7 @@ if active_record?
656
656
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
657
657
  end
658
658
 
659
- it "should detect unused preload associations" do
659
+ it 'should detect unused preload associations' do
660
660
  Page.includes(:author).map(&:name)
661
661
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
662
662
  expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Page, :author)
@@ -664,7 +664,7 @@ if active_record?
664
664
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
665
665
  end
666
666
 
667
- it "should not detect preload associations" do
667
+ it 'should not detect preload associations' do
668
668
  Page.all.map(&:name)
669
669
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
670
670
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
@@ -673,11 +673,11 @@ if active_record?
673
673
  end
674
674
  end
675
675
 
676
- context "disable n plus one query" do
676
+ context 'disable n plus one query' do
677
677
  before { Bullet.n_plus_one_query_enable = false }
678
678
  after { Bullet.n_plus_one_query_enable = true }
679
679
 
680
- it "should not detect n plus one query" do
680
+ it 'should not detect n plus one query' do
681
681
  Post.all.each do |post|
682
682
  post.comments.map(&:name)
683
683
  end
@@ -687,7 +687,7 @@ if active_record?
687
687
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
688
688
  end
689
689
 
690
- it "should still detect unused eager loading" do
690
+ it 'should still detect unused eager loading' do
691
691
  Post.includes(:comments).map(&:name)
692
692
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
693
693
 
@@ -696,11 +696,11 @@ if active_record?
696
696
  end
697
697
  end
698
698
 
699
- context "disable unused eager loading" do
699
+ context 'disable unused eager loading' do
700
700
  before { Bullet.unused_eager_loading_enable = false }
701
701
  after { Bullet.unused_eager_loading_enable = true }
702
702
 
703
- it "should not detect unused eager loading" do
703
+ it 'should not detect unused eager loading' do
704
704
  Post.includes(:comments).map(&:name)
705
705
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
706
706
 
@@ -708,7 +708,7 @@ if active_record?
708
708
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
709
709
  end
710
710
 
711
- it "should still detect n plus one query" do
711
+ it 'should still detect n plus one query' do
712
712
  Post.all.each do |post|
713
713
  post.comments.map(&:name)
714
714
  end
@@ -719,11 +719,11 @@ if active_record?
719
719
  end
720
720
  end
721
721
 
722
- context "whitelist n plus one query" do
723
- before { Bullet.add_whitelist :type => :n_plus_one_query, :class_name => "Post", :association => :comments }
722
+ context 'whitelist n plus one query' do
723
+ before { Bullet.add_whitelist :type => :n_plus_one_query, :class_name => 'Post', :association => :comments }
724
724
  after { Bullet.clear_whitelist }
725
725
 
726
- it "should not detect n plus one query" do
726
+ it 'should not detect n plus one query' do
727
727
  Post.all.each do |post|
728
728
  post.comments.map(&:name)
729
729
  end
@@ -733,7 +733,7 @@ if active_record?
733
733
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
734
734
  end
735
735
 
736
- it "should still detect unused eager loading" do
736
+ it 'should still detect unused eager loading' do
737
737
  Post.includes(:comments).map(&:name)
738
738
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
739
739
 
@@ -742,11 +742,11 @@ if active_record?
742
742
  end
743
743
  end
744
744
 
745
- context "whitelist unused eager loading" do
746
- before { Bullet.add_whitelist :type => :unused_eager_loading, :class_name => "Post", :association => :comments }
745
+ context 'whitelist unused eager loading' do
746
+ before { Bullet.add_whitelist :type => :unused_eager_loading, :class_name => 'Post', :association => :comments }
747
747
  after { Bullet.clear_whitelist }
748
748
 
749
- it "should not detect unused eager loading" do
749
+ it 'should not detect unused eager loading' do
750
750
  Post.includes(:comments).map(&:name)
751
751
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
752
752
 
@@ -754,7 +754,7 @@ if active_record?
754
754
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
755
755
  end
756
756
 
757
- it "should still detect n plus one query" do
757
+ it 'should still detect n plus one query' do
758
758
  Post.all.each do |post|
759
759
  post.comments.map(&:name)
760
760
  end