aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2005-10-16 14:23:28 +0000
committerNicholas Seckar <nseckar@gmail.com>2005-10-16 14:23:28 +0000
commit8103d373e698351029e6803ef59686a94a5d1207 (patch)
tree096e0e3261d8bd0f113c75b7599a82d8b3d3face /activesupport
parent6273753a42cde0a4d52eb276ed066749cb11523b (diff)
downloadrails-8103d373e698351029e6803ef59686a94a5d1207.tar.gz
rails-8103d373e698351029e6803ef59686a94a5d1207.tar.bz2
rails-8103d373e698351029e6803ef59686a94a5d1207.zip
Add unit tests for exception extensions
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2646 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/core_ext/exception_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/exception_test.rb b/activesupport/test/core_ext/exception_test.rb
new file mode 100644
index 0000000000..69990d4715
--- /dev/null
+++ b/activesupport/test/core_ext/exception_test.rb
@@ -0,0 +1,24 @@
+require 'test/unit'
+require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/exception'
+
+class ExceptionExtTests < Test::Unit::TestCase
+
+ def get_exception(cls = RuntimeError, msg = nil, trace = nil)
+ begin raise cls, msg, (trace || caller)
+ rescue Object => e
+ return e
+ end
+ end
+
+ def setup
+ Exception::TraceSubstitutions.clear
+ end
+
+ def test_clean_backtrace
+ Exception::TraceSubstitutions << [/\s*hidden.*/, '']
+ e = get_exception RuntimeError, 'RAWR', ['bhal.rb', 'rawh hid den stuff is not here', 'almost all']
+ assert_kind_of Exception, e
+ assert_equal ['bhal.rb', 'rawh hid den stuff is not here', 'almost all'], e.clean_backtrace
+ end
+
+end \ No newline at end of file