aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/exception_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/exception_test.rb')
-rw-r--r--activesupport/test/core_ext/exception_test.rb23
1 files changed, 21 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/exception_test.rb b/activesupport/test/core_ext/exception_test.rb
index 58f1ba5540..9b7afb1913 100644
--- a/activesupport/test/core_ext/exception_test.rb
+++ b/activesupport/test/core_ext/exception_test.rb
@@ -41,6 +41,25 @@ class ExceptionExtTests < Test::Unit::TestCase
assert_kind_of Exception, e
assert_equal ['vendor/file.rb some stuff', ' vendor/file.rb some stuff'], e.framework_backtrace
end
-
-end \ No newline at end of file
+ def test_backtrace_should_clean_paths
+ Exception::TraceSubstitutions << [/\s*hidden.*/, '']
+ e = get_exception RuntimeError, 'RAWR', ['a/b/c/../d/../../../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
+
+ def test_clean_message_should_clean_paths
+ Exception::TraceSubstitutions << [/\s*hidden.*/, '']
+ e = get_exception RuntimeError, "I dislike a/z/x/../../b/y/../c", ['a/b/c/../d/../../../bhal.rb', 'rawh hid den stuff is not here', 'almost all']
+ assert_kind_of Exception, e
+ assert_equal "I dislike a/b/c", e.clean_message
+ end
+
+ def test_app_trace_should_be_empty_when_no_app_frames
+ Exception::TraceSubstitutions << [/\s*hidden.*/, '']
+ e = get_exception RuntimeError, 'RAWR', ['vendor/file.rb some stuff', 'generated/bhal.rb', ' vendor/file.rb some stuff', 'generated/almost all']
+ assert_kind_of Exception, e
+ assert_equal [], e.application_backtrace
+ end
+end