diff --git a/app/models/impressionist/impressionable.rb b/app/models/impressionist/impressionable.rb index 6143538..5e7508f 100644 --- a/app/models/impressionist/impressionable.rb +++ b/app/models/impressionist/impressionable.rb @@ -17,6 +17,11 @@ module Impressionist def impressionist_counter_caching? impressionist_counter_cache_options.present? end + + def counter_caching? + ::ActiveSupport::Deprecation.warn("#counter_caching? is deprecated; please use #impressionist_counter_caching? instead") + impressionist_counter_caching? + end end def impressionable? diff --git a/test_app/spec/models/counter_caching_spec.rb b/test_app/spec/models/counter_caching_spec.rb index ac7b615..486a90b 100644 --- a/test_app/spec/models/counter_caching_spec.rb +++ b/test_app/spec/models/counter_caching_spec.rb @@ -18,6 +18,19 @@ describe Impression do end end + describe "self#counter_caching?" do + it "should know when counter caching is enabled" do + ActiveSupport::Deprecation.should_receive(:warn) + Widget.should be_counter_caching + end + + it "should know when counter caching is enabled" do + ActiveSupport::Deprecation.should_receive(:warn) + Article.should_not be_counter_caching + end + + end + describe "#update_impressionist_counter_cache" do it "should update the counter cache column to reflect the correct number of impressions" do lambda {