Created
January 16, 2014 12:45
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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