From bea333842fbd9273f6544e50b71e98fa73c4303e Mon Sep 17 00:00:00 2001 From: Raphael Sofaer <raphael@joindiaspora.com> Date: Fri, 29 Jul 2011 14:29:41 -0700 Subject: [PATCH] Make sure that a MissingInterpolationArgument in the english locale is raised --- lib/i18n_interpolation_fallbacks.rb | 2 +- spec/misc_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/i18n_interpolation_fallbacks.rb b/lib/i18n_interpolation_fallbacks.rb index 45c6dfe59b..067601bcb7 100644 --- a/lib/i18n_interpolation_fallbacks.rb +++ b/lib/i18n_interpolation_fallbacks.rb @@ -17,7 +17,7 @@ module I18n options.delete(:fallback) return super(locale, nil, options.merge(:default => default)) if default - raise(I18n::MissingInterpolationError.new(locale, key, options)) + raise(I18n::MissingInterpolationArgument.new(options, "key: #{key} in locale: #{locale}")) end end end diff --git a/spec/misc_spec.rb b/spec/misc_spec.rb index d11402caae..83af6674ce 100644 --- a/spec/misc_spec.rb +++ b/spec/misc_spec.rb @@ -75,6 +75,14 @@ describe 'making sure the spec runner works' do translation = translate('bob', :hey => "what") translation.should == "English translation" end + it 'MissingInterpolationError with no fallback is fatal' do + I18n.backend.stub!(:lookup). + with(:en, 'bob', nil, :hey => "what", :fallback => true). + and_return("English translation %{that_will_fail}") + lambda { + translate('bob', :hey => "what") + }.should raise_error I18n::MissingInterpolationArgument + end end end -- GitLab