From 5e08a10fb083a37c452d84321fd493332ff64f1a Mon Sep 17 00:00:00 2001 From: Adam Meehan Date: Mon, 21 Jul 2008 13:48:25 +1000 Subject: [PATCH] renamed calls to timeliness_date_time_parse to parse_date_time which will correctly an overrided method --- lib/validates_timeliness/attribute_methods.rb | 2 +- lib/validates_timeliness/validations.rb | 2 +- spec/attribute_methods_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/validates_timeliness/attribute_methods.rb b/lib/validates_timeliness/attribute_methods.rb index 9b786f9..31ca783 100644 --- a/lib/validates_timeliness/attribute_methods.rb +++ b/lib/validates_timeliness/attribute_methods.rb @@ -35,7 +35,7 @@ module ValidatesTimeliness # Does strict time type cast checking for Rails 2.1 timezone handling def strict_time_type_cast(time) - time = self.class.timeliness_date_time_parse(time, :datetime) + time = self.class.parse_date_time(time, :datetime) time_in_time_zone(time) end diff --git a/lib/validates_timeliness/validations.rb b/lib/validates_timeliness/validations.rb index e174743..491ce93 100644 --- a/lib/validates_timeliness/validations.rb +++ b/lib/validates_timeliness/validations.rb @@ -132,7 +132,7 @@ module ValidatesTimeliness when Proc restriction.call(record) else - timeliness_date_time_parse(restriction, configuration[:type], false) + parse_date_time(restriction, configuration[:type], false) end next if compare.nil? diff --git a/spec/attribute_methods_spec.rb b/spec/attribute_methods_spec.rb index 4e1f8b4..59504f1 100644 --- a/spec/attribute_methods_spec.rb +++ b/spec/attribute_methods_spec.rb @@ -21,7 +21,7 @@ describe ValidatesTimeliness::AttributeMethods do strict_time_type_cast("2000-02-01 25:13:14").should be_nil end - it "should return time object for time object" do + it "should return Time object when passed a Time object" do strict_time_type_cast(Time.now).should be_kind_of(Time) end