mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-23 06:16:44 +00:00
parse using timeliness_restriction_value method on matcher option values to allow all possible value types
This commit is contained in:
parent
097e2c58ba
commit
9a76d06309
@ -63,7 +63,7 @@ module Spec
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parse_and_cast(value)
|
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])
|
cast_method = ActiveRecord::Base.send(:restriction_type_cast_method, options[:type])
|
||||||
value.send(cast_method) rescue nil
|
value.send(cast_method) rescue nil
|
||||||
end
|
end
|
||||||
@ -85,7 +85,7 @@ module Spec
|
|||||||
|
|
||||||
def no_error_matching(value, match)
|
def no_error_matching(value, match)
|
||||||
pass = !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
|
pass
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user