Deprecation warning for counter_caching?

This commit is contained in:
Ross Kaffenberger 2012-03-19 15:56:42 -04:00
parent 4c2c09ca69
commit f59f897d25
2 changed files with 18 additions and 0 deletions

View File

@ -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?

View File

@ -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 {