diff options
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/exception_test.rb | 23 | ||||
-rw-r--r-- | activesupport/test/core_ext/symbol_test.rb | 8 | ||||
-rw-r--r-- | activesupport/test/core_ext/symbol_tests.rb (renamed from activesupport/test/core_ext/symbol.rb) | 0 |
3 files changed, 29 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 diff --git a/activesupport/test/core_ext/symbol_test.rb b/activesupport/test/core_ext/symbol_test.rb new file mode 100644 index 0000000000..fec504d9d1 --- /dev/null +++ b/activesupport/test/core_ext/symbol_test.rb @@ -0,0 +1,8 @@ +require 'test/unit' +require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/symbol' + +class SymbolTests < Test::Unit::TestCase + def test_to_proc + assert_equal %w(one two three), [:one, :two, :three].map(&:to_s) + end +end diff --git a/activesupport/test/core_ext/symbol.rb b/activesupport/test/core_ext/symbol_tests.rb index ae2c585fc2..ae2c585fc2 100644 --- a/activesupport/test/core_ext/symbol.rb +++ b/activesupport/test/core_ext/symbol_tests.rb |