parse using timeliness_restriction_value method on matcher option values to allow all possible value types

This commit is contained in:
Adam Meehan 2008-08-07 12:24:17 +10:00
parent 097e2c58ba
commit 9a76d06309

View File

@ -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