From 014bb7662250b3961857d8e49c5f8042e7427b0c Mon Sep 17 00:00:00 2001 From: Adam Meehan Date: Sat, 26 Feb 2011 13:08:11 +1100 Subject: [PATCH] remove :equal_to deprecation message --- lib/validates_timeliness/validator.rb | 8 -------- spec/validator_spec.rb | 14 -------------- 2 files changed, 22 deletions(-) diff --git a/lib/validates_timeliness/validator.rb b/lib/validates_timeliness/validator.rb index 16bd42d..f6dce10 100644 --- a/lib/validates_timeliness/validator.rb +++ b/lib/validates_timeliness/validator.rb @@ -1,4 +1,3 @@ -#TODO remove deprecated option :equal_to module ValidatesTimeliness class Validator @@ -8,7 +7,6 @@ module ValidatesTimeliness RESTRICTION_METHODS = { :is_at => :==, - :equal_to => :==, :before => :<, :after => :>, :on_or_before => :<=, @@ -143,12 +141,6 @@ module ValidatesTimeliness end def validate_options(options) - if options.key?(:equal_to) - ::ActiveSupport::Deprecation.warn("ValidatesTimeliness :equal_to option is deprecated due to clash with a default Rails option. Use :is_at instead. You will need to fix any I18n error message references to this option date/time attributes now.") - options[:is_at] = options.delete(:equal_to) - options[:is_at_message] = options.delete(:equal_to_message) - end - invalid_for_type = ([:time, :date, :datetime] - [type]).map {|k| "invalid_#{k}_message".to_sym } invalid_for_type << :with_date unless type == :time invalid_for_type << :with_time unless type == :date diff --git a/spec/validator_spec.rb b/spec/validator_spec.rb index b9826fa..6390009 100644 --- a/spec/validator_spec.rb +++ b/spec/validator_spec.rb @@ -25,10 +25,6 @@ describe ValidatesTimeliness::Validator do end describe "option keys validation" do - before(:all) do - ActiveSupport::Deprecation.silenced = true - end - before do keys = ValidatesTimeliness::Validator::VALID_OPTION_KEYS - [:invalid_date_message, :invalid_time_message, :with_date, :with_time] @valid_options = keys.inject({}) {|hash, opt| hash[opt] = nil; hash } @@ -42,15 +38,6 @@ describe ValidatesTimeliness::Validator do it "should not raise error if option keys are valid" do lambda { Person.validates_datetime(@valid_options) }.should_not raise_error(ArgumentError) end - - it "should display deprecation notice for :equal_to" do - ::ActiveSupport::Deprecation.should_receive(:warn) - Person.validates_datetime :equal_to => Time.now - end - - after(:all) do - ActiveSupport::Deprecation.silenced = false - end end describe "evaluate_option_value" do @@ -429,7 +416,6 @@ describe ValidatesTimeliness::Validator do end describe "instance with :with_time option" do - it "should validate date attribute as datetime combining value of :with_time against restrictions " do configure_validator(:type => :date, :with_time => '12:31', :on_or_before => Time.mktime(2000,1,1,12,30)) validate_with(:birth_date, "2000-01-01")