bullet 4.5.0 → 4.6.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/CHANGELOG.md +4 -0
- data/README.md +7 -5
- data/bullet.gemspec +2 -2
- data/lib/bullet.rb +5 -15
- data/lib/bullet/active_record3.rb +8 -0
- data/lib/bullet/active_record3x.rb +10 -0
- data/lib/bullet/active_record4.rb +10 -0
- data/lib/bullet/dependency.rb +8 -21
- data/lib/bullet/detector/n_plus_one_query.rb +5 -3
- data/lib/bullet/rack.rb +17 -7
- data/lib/bullet/version.rb +1 -1
- data/spec/integration/association_spec.rb +13 -0
- data/spec/models/comment.rb +1 -1
- data/spec/models/post.rb +5 -12
- data/spec/spec_helper.rb +1 -7
- data/test.sh +0 -1
- metadata +5 -13
- data/Gemfile.rails-2.3.17 +0 -14
- data/README_for_rails2.textile +0 -400
- data/lib/bullet/action_controller2.rb +0 -50
- data/lib/bullet/active_record2.rb +0 -121
- data/spec/integration/rails2/association_spec.rb +0 -593
- data/spec/integration/rails2/counter_cache_spec.rb +0 -51
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
if active_record2?
|
4
|
-
describe Bullet::Detector::CounterCache do
|
5
|
-
before(:each) do
|
6
|
-
Bullet.start_request
|
7
|
-
end
|
8
|
-
|
9
|
-
after(:each) do
|
10
|
-
Bullet.end_request
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should need counter cache with all cities" do
|
14
|
-
Country.all.each do |country|
|
15
|
-
country.cities.size
|
16
|
-
end
|
17
|
-
Bullet.collected_counter_cache_notifications.should_not be_empty
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should not need counter cache if already define counter_cache" do
|
21
|
-
Person.all.each do |person|
|
22
|
-
person.pets.size
|
23
|
-
end
|
24
|
-
Bullet.collected_counter_cache_notifications.should be_empty
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should not need counter cache with only one object" do
|
28
|
-
Country.first.cities.size
|
29
|
-
Bullet.collected_counter_cache_notifications.should be_empty
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should not need counter cache with part of cities" do
|
33
|
-
Country.all.each do |country|
|
34
|
-
country.cities.find(:all, :conditions => {:name => 'first'}).size
|
35
|
-
end
|
36
|
-
Bullet.collected_counter_cache_notifications.should be_empty
|
37
|
-
end
|
38
|
-
|
39
|
-
context "disable" do
|
40
|
-
before { Bullet.counter_cache_enable = false }
|
41
|
-
after { Bullet.counter_cache_enable = true }
|
42
|
-
|
43
|
-
it "should not detect counter cache" do
|
44
|
-
Country.all.each do |country|
|
45
|
-
country.cities.size
|
46
|
-
end
|
47
|
-
expect(Bullet.collected_counter_cache_notifications).to be_empty
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|