aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-01-28 07:10:35 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-01-28 07:10:35 +0000
commit4ac332fa9a16ae86b948251e372999b9f4618dec (patch)
tree76bd0c6fb4feefe34ee2de76cf8dcb787993604b /actionpack/test/controller
parentdde527440a52317e2e7eb4a928009c036cdf772b (diff)
downloadrails-4ac332fa9a16ae86b948251e372999b9f4618dec.tar.gz
rails-4ac332fa9a16ae86b948251e372999b9f4618dec.tar.bz2
rails-4ac332fa9a16ae86b948251e372999b9f4618dec.zip
Fix Test::Unit::TestCase#clean_backtrace
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6056 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/test_test.rb32
1 files changed, 30 insertions, 2 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index 2b0086c5f4..ab44fbf3ca 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/../abstract_unit'
-require File.dirname(__FILE__) + '/fake_controllers'
+require "#{File.dirname(__FILE__)}/../abstract_unit"
+require "#{File.dirname(__FILE__)}/fake_controllers"
class TestTest < Test::Unit::TestCase
class TestController < ActionController::Base
@@ -493,3 +493,31 @@ HTML
end
end
end
+
+
+class CleanBacktraceTest < Test::Unit::TestCase
+ def test_should_reraise_the_same_object
+ exception = Test::Unit::AssertionFailedError.new('message')
+ clean_backtrace { raise exception }
+ rescue => caught
+ assert_equal exception.object_id, caught.object_id
+ assert_equal exception.message, caught.message
+ end
+
+ def test_should_clean_assertion_lines_from_backtrace
+ path = File.expand_path("#{File.dirname(__FILE__)}/../../lib/action_controller")
+ exception = Test::Unit::AssertionFailedError.new('message')
+ exception.set_backtrace ["#{path}/abc", "#{path}/assertions/def"]
+ clean_backtrace { raise exception }
+ rescue => caught
+ assert_equal ["#{path}/abc"], caught.backtrace
+ end
+
+ def test_should_only_clean_assertion_failure_errors
+ clean_backtrace do
+ raise "can't touch this", [File.expand_path("#{File.dirname(__FILE__)}/../../lib/action_controller/assertions/abc")]
+ end
+ rescue => caught
+ assert !caught.backtrace.empty?
+ end
+end