bullet 4.5.0 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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