bullet 4.14.8 → 5.0.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.
- checksums.yaml +4 -4
- data/.travis.yml +30 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile.mongoid-5.0 +17 -0
- data/Gemfile.rails-5.0 +17 -0
- data/README.md +5 -0
- data/lib/bullet/active_record3.rb +7 -5
- data/lib/bullet/active_record3x.rb +3 -3
- data/lib/bullet/active_record4.rb +12 -2
- data/lib/bullet/active_record41.rb +12 -2
- data/lib/bullet/active_record42.rb +23 -4
- data/lib/bullet/active_record5.rb +217 -0
- data/lib/bullet/dependency.rb +16 -0
- data/lib/bullet/detector/n_plus_one_query.rb +8 -2
- data/lib/bullet/detector/unused_eager_loading.rb +1 -1
- data/lib/bullet/mongoid5x.rb +56 -0
- data/lib/bullet/version.rb +1 -1
- data/lib/bullet.rb +16 -4
- data/spec/bullet/detector/n_plus_one_query_spec.rb +15 -0
- data/spec/bullet/notification/base_spec.rb +2 -2
- data/spec/bullet_spec.rb +47 -0
- data/spec/integration/active_record3/association_spec.rb +2 -2
- data/spec/integration/active_record4/association_spec.rb +23 -2
- data/spec/integration/active_record5/association_spec.rb +715 -0
- data/spec/integration/counter_cache_spec.rb +17 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/mongo_seed.rb +13 -0
- data/test.sh +1 -0
- data/update.sh +1 -0
- metadata +9 -3
|
@@ -29,6 +29,22 @@ if !mongoid? && active_record?
|
|
|
29
29
|
expect(Bullet.collected_counter_cache_notifications).to be_empty
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
if active_record5?
|
|
33
|
+
it "should not need counter cache for has_many through" do
|
|
34
|
+
Client.all.each do |client|
|
|
35
|
+
client.firms.size
|
|
36
|
+
end
|
|
37
|
+
expect(Bullet.collected_counter_cache_notifications).to be_empty
|
|
38
|
+
end
|
|
39
|
+
else
|
|
40
|
+
it "should need counter cache for has_many through" do
|
|
41
|
+
Client.all.each do |client|
|
|
42
|
+
client.firms.size
|
|
43
|
+
end
|
|
44
|
+
expect(Bullet.collected_counter_cache_notifications).not_to be_empty
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
32
48
|
it "should not need counter cache with part of cities" do
|
|
33
49
|
Country.all.each do |country|
|
|
34
50
|
country.cities.where(:name => 'first').size
|
|
@@ -50,7 +66,7 @@ if !mongoid? && active_record?
|
|
|
50
66
|
|
|
51
67
|
context "whitelist" do
|
|
52
68
|
before { Bullet.add_whitelist :type => :counter_cache, :class_name => "Country", :association => :cities }
|
|
53
|
-
after { Bullet.
|
|
69
|
+
after { Bullet.clear_whitelist }
|
|
54
70
|
|
|
55
71
|
it "should not detect counter cache" do
|
|
56
72
|
Country.all.each do |country|
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/mongo_seed.rb
CHANGED
|
@@ -52,6 +52,19 @@ module Support
|
|
|
52
52
|
}
|
|
53
53
|
)
|
|
54
54
|
end
|
|
55
|
+
elsif Mongoid::VERSION =~ /\A5/
|
|
56
|
+
Mongoid.configure do |config|
|
|
57
|
+
config.load_configuration(
|
|
58
|
+
clients: {
|
|
59
|
+
default: {
|
|
60
|
+
database: "bullet",
|
|
61
|
+
hosts: [ "localhost:27017" ]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
# Increase the level from DEBUG in order to avoid excessive logging to the screen
|
|
67
|
+
Mongo::Logger.logger.level = Logger::WARN
|
|
55
68
|
end
|
|
56
69
|
end
|
|
57
70
|
|
data/test.sh
CHANGED
|
@@ -6,6 +6,7 @@ BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.0 bund
|
|
|
6
6
|
BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle exec rspec spec
|
|
7
7
|
BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle exec rspec spec
|
|
8
8
|
BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle exec rspec spec
|
|
9
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle exec rspec spec
|
|
9
10
|
BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle exec rspec spec
|
|
10
11
|
BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle exec rspec spec
|
|
11
12
|
BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle exec rspec spec
|
data/update.sh
CHANGED
|
@@ -4,6 +4,7 @@ BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle update
|
|
|
4
4
|
BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle update
|
|
5
5
|
BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle update
|
|
6
6
|
BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle update
|
|
7
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle update
|
|
7
8
|
BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle update
|
|
8
9
|
BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle update
|
|
9
10
|
BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle update
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bullet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Richard Huang
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -59,12 +59,14 @@ files:
|
|
|
59
59
|
- Gemfile.mongoid-3.0
|
|
60
60
|
- Gemfile.mongoid-3.1
|
|
61
61
|
- Gemfile.mongoid-4.0
|
|
62
|
+
- Gemfile.mongoid-5.0
|
|
62
63
|
- Gemfile.rails-3.0
|
|
63
64
|
- Gemfile.rails-3.1
|
|
64
65
|
- Gemfile.rails-3.2
|
|
65
66
|
- Gemfile.rails-4.0
|
|
66
67
|
- Gemfile.rails-4.1
|
|
67
68
|
- Gemfile.rails-4.2
|
|
69
|
+
- Gemfile.rails-5.0
|
|
68
70
|
- Guardfile
|
|
69
71
|
- Hacking.md
|
|
70
72
|
- MIT-LICENSE
|
|
@@ -77,6 +79,7 @@ files:
|
|
|
77
79
|
- lib/bullet/active_record4.rb
|
|
78
80
|
- lib/bullet/active_record41.rb
|
|
79
81
|
- lib/bullet/active_record42.rb
|
|
82
|
+
- lib/bullet/active_record5.rb
|
|
80
83
|
- lib/bullet/dependency.rb
|
|
81
84
|
- lib/bullet/detector.rb
|
|
82
85
|
- lib/bullet/detector/association.rb
|
|
@@ -89,6 +92,7 @@ files:
|
|
|
89
92
|
- lib/bullet/mongoid2x.rb
|
|
90
93
|
- lib/bullet/mongoid3x.rb
|
|
91
94
|
- lib/bullet/mongoid4x.rb
|
|
95
|
+
- lib/bullet/mongoid5x.rb
|
|
92
96
|
- lib/bullet/notification.rb
|
|
93
97
|
- lib/bullet/notification/base.rb
|
|
94
98
|
- lib/bullet/notification/counter_cache.rb
|
|
@@ -122,6 +126,7 @@ files:
|
|
|
122
126
|
- spec/bullet_spec.rb
|
|
123
127
|
- spec/integration/active_record3/association_spec.rb
|
|
124
128
|
- spec/integration/active_record4/association_spec.rb
|
|
129
|
+
- spec/integration/active_record5/association_spec.rb
|
|
125
130
|
- spec/integration/counter_cache_spec.rb
|
|
126
131
|
- spec/integration/mongoid/association_spec.rb
|
|
127
132
|
- spec/models/address.rb
|
|
@@ -184,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
184
189
|
version: 1.3.6
|
|
185
190
|
requirements: []
|
|
186
191
|
rubyforge_project:
|
|
187
|
-
rubygems_version: 2.
|
|
192
|
+
rubygems_version: 2.5.1
|
|
188
193
|
signing_key:
|
|
189
194
|
specification_version: 4
|
|
190
195
|
summary: help to kill N+1 queries and unused eager loading.
|
|
@@ -208,6 +213,7 @@ test_files:
|
|
|
208
213
|
- spec/bullet_spec.rb
|
|
209
214
|
- spec/integration/active_record3/association_spec.rb
|
|
210
215
|
- spec/integration/active_record4/association_spec.rb
|
|
216
|
+
- spec/integration/active_record5/association_spec.rb
|
|
211
217
|
- spec/integration/counter_cache_spec.rb
|
|
212
218
|
- spec/integration/mongoid/association_spec.rb
|
|
213
219
|
- spec/models/address.rb
|