spec/bullet_counter_spec.rb in flyerhzm-bullet-1.4.1 vs spec/bullet_counter_spec.rb in flyerhzm-bullet-1.5.0
- old
+ new
@@ -52,16 +52,23 @@
after(:each) do
Bullet::Counter.end_request
end
- it "should need counter cache with count" do
+ it "should need counter cache with all cities" do
Country.all.each do |country|
country.cities.size
end
Bullet::Counter.should be_need_counter_caches
end
+
+ it "should not need counter cache with part of cities" do
+ Country.all.each do |country|
+ country.cities(:conditions => ["name = ?", 'first']).size
+ end
+ Bullet::Counter.should_not be_need_counter_cache
+ end
end
describe Bullet::Counter do
def setup_db
ActiveRecord::Schema.define(:version => 1) do
@@ -113,10 +120,10 @@
after(:each) do
Bullet::Counter.end_request
end
- it "should need counter cache with count" do
+ it "should not need counter cache" do
Person.all.each do |person|
person.pets.size
end
Bullet::Counter.should_not be_need_counter_caches
end