diff options
author | Xavier Noria <fxn@hashref.com> | 2013-08-13 01:38:48 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-08-13 01:44:52 +0200 |
commit | c7ac0a5b28e1403371e4c65666ec92dd2bf0e0d6 (patch) | |
tree | 8eb093a183943e1d96153c520683541ce489e6d8 | |
parent | 4c1454db22cb42d185afc58312e1d62c0f542f44 (diff) | |
download | rails-c7ac0a5b28e1403371e4c65666ec92dd2bf0e0d6.tar.gz rails-c7ac0a5b28e1403371e4c65666ec92dd2bf0e0d6.tar.bz2 rails-c7ac0a5b28e1403371e4c65666ec92dd2bf0e0d6.zip |
renames the :abort deprecation behaviour to :raise
That is a better name, thanks @jeremy.
-rw-r--r-- | activesupport/CHANGELOG.md | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/deprecation/behaviors.rb | 4 | ||||
-rw-r--r-- | activesupport/test/deprecation_test.rb | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index a4f3addaa6..321e30681b 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,7 +1,7 @@ -* Adds a new deprecation behaviour that aborts the application. Throwing this +* Adds a new deprecation behaviour that raises an exception. Throwing this line into +config/environments/development.rb+ - ActiveSupport::Deprecation.behavior = :abort + ActiveSupport::Deprecation.behavior = :raise will cause the application to raise an +ActiveSupport::DeprecationException+ on deprecations. diff --git a/activesupport/lib/active_support/deprecation/behaviors.rb b/activesupport/lib/active_support/deprecation/behaviors.rb index 8c7d80c134..328b8c320a 100644 --- a/activesupport/lib/active_support/deprecation/behaviors.rb +++ b/activesupport/lib/active_support/deprecation/behaviors.rb @@ -7,7 +7,7 @@ module ActiveSupport class Deprecation # Default warning behaviors per Rails.env. DEFAULT_BEHAVIORS = { - abort: ->(message, callstack) { + raise: ->(message, callstack) { e = DeprecationException.new(message) e.set_backtrace(callstack) raise e @@ -52,7 +52,7 @@ module ActiveSupport # # Available behaviors: # - # [+abort+] Raises <tt>ActiveSupport::DeprecationException</tt>. + # [+raise+] Raise <tt>ActiveSupport::DeprecationException</tt>. # [+stderr+] Log all deprecation warnings to +$stderr+. # [+log+] Log all deprecation warnings to +Rails.logger+. # [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+. diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb index 641e5a210c..9674851b9d 100644 --- a/activesupport/test/deprecation_test.rb +++ b/activesupport/test/deprecation_test.rb @@ -98,8 +98,8 @@ class DeprecationTest < ActiveSupport::TestCase assert_match(/foo=nil/, @b) end - def test_abort_behaviour - ActiveSupport::Deprecation.behavior = :abort + def test_raise_behaviour + ActiveSupport::Deprecation.behavior = :raise message = 'Revise this deprecated stuff now!' callstack = %w(foo bar baz) @@ -110,7 +110,7 @@ class DeprecationTest < ActiveSupport::TestCase assert_equal message, e.message assert_equal callstack, e.backtrace else - flunk 'the :abort deprecation behaviour should raise the expected exception' + flunk 'the :raise deprecation behaviour should raise the expected exception' end end |