Skip to content

Instantly share code, notes, and snippets.

@costa
Created January 16, 2014 12:45
Show Gist options
  • Save costa/8454458 to your computer and use it in GitHub Desktop.
Save costa/8454458 to your computer and use it in GitHub Desktop.
a proper config/initializer to catch all the i18n errors (hopefully) within rails 3.2 test environment
if Rails.env.test?
module I18n
def self.just_raise_that_exception(*args)
raise args.first
end
end
I18n.exception_handler = :just_raise_that_exception
module ActionView::Helpers::TranslationHelper
def translate_with_raise(key, options = {})
translate_without_raise key, options.merge(:raise => true)
end
alias_method_chain :translate, :raise
alias_method :t, :translate
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment