fix matcher error_message_for when i18n is loaded and custom error message to use regular string interpolation

This commit is contained in:
Adam Meehan 2009-01-12 13:04:41 +11:00
parent 011ea070db
commit 9f1642c730

View File

@ -124,7 +124,7 @@ module Spec
restriction.map! {|r| @validator.send(:type_cast_value, r) }
interpolate = @validator.send(:interpolation_values, option, restriction )
# get I18n message if defined and has interpolation keys in msg
if defined?(I18n) && msg.match(/\{\{/)
if defined?(I18n) && !@validator.send(:custom_error_messages).include?(option)
msg = @record.errors.generate_message(@expected, option, interpolate)
else
msg = msg % interpolate