aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/deprecation_test.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2013-08-12 23:23:21 +0000
committerXavier Noria <fxn@hashref.com>2013-08-13 01:27:18 +0200
commit73aad75f5665607e1abc2cf0a69460a923bbd571 (patch)
tree79f528f24975a4ec2a0458c73d6ff7484045d040 /activesupport/test/deprecation_test.rb
parent1577d9661a9ee0268d9f101c6c7f6435a87e8de0 (diff)
downloadrails-73aad75f5665607e1abc2cf0a69460a923bbd571.tar.gz
rails-73aad75f5665607e1abc2cf0a69460a923bbd571.tar.bz2
rails-73aad75f5665607e1abc2cf0a69460a923bbd571.zip
defines a new :abort deprecation behaviour that raises
See the CHANGELONG message in the patch for further details.
Diffstat (limited to 'activesupport/test/deprecation_test.rb')
-rw-r--r--activesupport/test/deprecation_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb
index 9616e42f44..641e5a210c 100644
--- a/activesupport/test/deprecation_test.rb
+++ b/activesupport/test/deprecation_test.rb
@@ -98,6 +98,22 @@ class DeprecationTest < ActiveSupport::TestCase
assert_match(/foo=nil/, @b)
end
+ def test_abort_behaviour
+ ActiveSupport::Deprecation.behavior = :abort
+
+ message = 'Revise this deprecated stuff now!'
+ callstack = %w(foo bar baz)
+
+ begin
+ ActiveSupport::Deprecation.behavior.first.call(message, callstack)
+ rescue ActiveSupport::DeprecationException => e
+ assert_equal message, e.message
+ assert_equal callstack, e.backtrace
+ else
+ flunk 'the :abort deprecation behaviour should raise the expected exception'
+ end
+ end
+
def test_default_stderr_behavior
ActiveSupport::Deprecation.behavior = :stderr
behavior = ActiveSupport::Deprecation.behavior.first