mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-25 15:22:58 +00:00
parse using timeliness_restriction_value method on matcher option values to allow all possible value types
This commit is contained in:
@@ -63,7 +63,7 @@ module Spec
|
||||
end
|
||||
|
||||
def parse_and_cast(value)
|
||||
value = ActiveRecord::Base.parse_date_time(value, options[:type])
|
||||
value = ActiveRecord::Base.send(:timeliness_restriction_value, value, record, options[:type])
|
||||
cast_method = ActiveRecord::Base.send(:restriction_type_cast_method, options[:type])
|
||||
value.send(cast_method) rescue nil
|
||||
end
|
||||
@@ -85,7 +85,7 @@ module Spec
|
||||
|
||||
def no_error_matching(value, match)
|
||||
pass = !error_matching(value, match)
|
||||
@last_failure = "error matching #{match.inspect} when value is #{format_value(value)}" unless pass
|
||||
@last_failure = "no error matching #{match.inspect} when value is #{format_value(value)}" unless pass
|
||||
pass
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user