aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-04-04 19:37:29 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-04-04 19:37:29 +0000
commite714b25723b674bb6d66af40ea9047166907616b (patch)
tree757a0368a8cef19d5c951d68162ea73dabb6edaa /activesupport/test
parent62dc792a484e6e62fb2fb87fd47819144c5e3301 (diff)
downloadrails-e714b25723b674bb6d66af40ea9047166907616b.tar.gz
rails-e714b25723b674bb6d66af40ea9047166907616b.tar.bz2
rails-e714b25723b674bb6d66af40ea9047166907616b.zip
Update the diagnostics template skip the useless '<controller not set>' text.
Fix symbol extensions test case. Clean paths inside of exception messages and traces. Add Pathname.clean_within for cleaning all the paths inside of a string. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4158 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/exception_test.rb23
-rw-r--r--activesupport/test/core_ext/symbol_test.rb8
-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