renamed methods which have been moved out of AR and so dont need to be fully qualified

This commit is contained in:
Adam Meehan 2008-12-02 20:34:02 +11:00
parent d71f581e10
commit 3ac65b507f
4 changed files with 10 additions and 10 deletions

View File

@ -24,13 +24,13 @@ ValidatesTimeliness::Formats.compile_format_expressions
module ValidatesTimeliness
mattr_accessor :ignore_datetime_restriction_errors
mattr_accessor :date_time_error_value_formats
mattr_accessor :ignore_restriction_errors
mattr_accessor :error_value_formats
mattr_accessor :default_error_messages
@@ignore_datetime_restriction_errors = false
@@ignore_restriction_errors = false
@@date_time_error_value_formats = {
@@error_value_formats = {
:time => '%H:%M:%S',
:date => '%Y-%m-%d',
:datetime => '%Y-%m-%d %H:%M:%S'

View File

@ -92,7 +92,7 @@ module Spec
def format_value(value)
return value if value.is_a?(String)
value.strftime(ValidatesTimeliness.date_time_error_value_formats[options[:type]])
value.strftime(ValidatesTimeliness.error_value_formats[options[:type]])
end
end

View File

@ -36,7 +36,7 @@ module ValidatesTimeliness
type_cast_method = self.class.restriction_type_cast_method(type)
display = ValidatesTimeliness.date_time_error_value_formats[type]
display = ValidatesTimeliness.error_value_formats[type]
value = value.send(type_cast_method)
@ -51,7 +51,7 @@ module ValidatesTimeliness
add_error(record, attr_name, error_messages[option] % compare.strftime(display))
end
rescue
unless ValidatesTimeliness.ignore_datetime_restriction_errors
unless ValidatesTimeliness.ignore_restriction_errors
add_error(record, attr_name, "restriction '#{option}' value was invalid")
end
end

View File

@ -376,11 +376,11 @@ describe ValidatesTimeliness::ValidationMethods do
end
before :all do
ValidatesTimeliness.ignore_datetime_restriction_errors = true
ValidatesTimeliness.ignore_restriction_errors = true
end
after :all do
ValidatesTimeliness.ignore_datetime_restriction_errors = false
ValidatesTimeliness.ignore_restriction_errors = false
end
before :each do
@ -426,7 +426,7 @@ describe ValidatesTimeliness::ValidationMethods do
describe "custom formats" do
before :all do
ValidatesTimeliness.date_time_error_value_formats = {
ValidatesTimeliness.error_value_formats = {
:time => '%H:%M %p',
:date => '%d-%m-%Y',
:datetime => '%d-%m-%Y %H:%M %p'