From 9f1642c7306b4004cedcef194591d4caec557b0f Mon Sep 17 00:00:00 2001 From: Adam Meehan Date: Mon, 12 Jan 2009 13:04:41 +1100 Subject: [PATCH] fix matcher error_message_for when i18n is loaded and custom error message to use regular string interpolation --- .../spec/rails/matchers/validate_timeliness.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/validates_timeliness/spec/rails/matchers/validate_timeliness.rb b/lib/validates_timeliness/spec/rails/matchers/validate_timeliness.rb index ad65f74..2616d77 100644 --- a/lib/validates_timeliness/spec/rails/matchers/validate_timeliness.rb +++ b/lib/validates_timeliness/spec/rails/matchers/validate_timeliness.rb @@ -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