Permalink
Browse files

Fix instance variable not defined warnings due to added deprecations

Also fix the rescue_format deprecation, it seems it was never being
triggered because it was checking for the existence of a not yet defined
variable.
  • Loading branch information...
1 parent 12aa0f0 commit 3d039354e36005a1829e015dc7bf37f865529a35 @carlosantoniodasilva carlosantoniodasilva committed Dec 12, 2013
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/i18n.rb
  2. +1 −1 lib/i18n/exceptions.rb
  3. +1 −1 test/i18n/exceptions_test.rb
View
@@ -358,8 +358,8 @@ def default_exception_handler(exception, locale, key, options)
end
def handle_enforce_available_locales_deprecation
- if config.enforce_available_locales.nil? && !@unenforced_available_locales_deprecation
- $stderr.puts "[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message."
+ if config.enforce_available_locales.nil? && !defined?(@unenforced_available_locales_deprecation)
+ $stderr.puts "[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message."
@unenforced_available_locales_deprecation = true
end
end
View
@@ -13,7 +13,7 @@ def call(exception, locale, key, options)
# TODO: this block is to be replaced by `exception.message` when
# rescue_format is removed
if options[:rescue_format] == :html
- if @rescue_format_deprecation
+ if !defined?(@rescue_format_deprecation)
$stderr.puts "[DEPRECATED] I18n's :recue_format option will be removed from a future release. All exception messages will be plain text. If you need the exception handler to return an html format please set or pass a custom exception handler."
@rescue_format_deprecation = true
end
@@ -3,7 +3,7 @@
class I18nExceptionsTest < Test::Unit::TestCase
def test_invalid_locale_stores_locale
force_invalid_locale
- rescue I18n::ArgumentError => e
+ rescue I18n::ArgumentError => exception
assert_nil exception.locale
end

0 comments on commit 3d03935

Please sign in to comment.