aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/assertions.rb
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/lib/action_controller/assertions.rb
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/lib/action_controller/assertions.rb')
-rw-r--r--actionpack/lib/action_controller/assertions.rb28
1 files changed, 9 insertions, 19 deletions
diff --git a/actionpack/lib/action_controller/assertions.rb b/actionpack/lib/action_controller/assertions.rb
index f52076e863..956e5da140 100644
--- a/actionpack/lib/action_controller/assertions.rb
+++ b/actionpack/lib/action_controller/assertions.rb
@@ -9,7 +9,7 @@ module ActionController #:nodoc:
# * session: Objects being saved in the session.
# * flash: The flash objects currently in the session.
# * cookies: Cookies being sent to the user on this request.
- #
+ #
# These collections can be used just like any other hash:
#
# assert_not_nil assigns(:person) # makes sure that a @person instance variable was set
@@ -40,37 +40,27 @@ module ActionController #:nodoc:
# == Testing named routes
#
# If you're using named routes, they can be easily tested using the original named routes methods straight in the test case.
- # Example:
+ # Example:
#
# assert_redirected_to page_url(:title => 'foo')
module Assertions
def self.included(klass)
- klass.class_eval do
- include ActionController::Assertions::ResponseAssertions
- include ActionController::Assertions::SelectorAssertions
- include ActionController::Assertions::RoutingAssertions
- include ActionController::Assertions::TagAssertions
- include ActionController::Assertions::DomAssertions
- include ActionController::Assertions::ModelAssertions
+ %w(response selector tag dom routing model).each do |kind|
+ require "action_controller/assertions/#{kind}_assertions"
+ klass.send :include, const_get("#{kind.camelize}Assertions")
end
end
def clean_backtrace(&block)
yield
- rescue Test::Unit::AssertionFailedError => e
- path = File.expand_path(__FILE__)
- raise Test::Unit::AssertionFailedError, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ }
+ rescue Test::Unit::AssertionFailedError => error
+ framework_path = Regexp.new(File.expand_path("#{File.dirname(__FILE__)}/assertions"))
+ error.backtrace.reject! { |line| File.expand_path(line) =~ framework_path }
+ raise
end
end
end
-require File.dirname(__FILE__) + '/assertions/response_assertions'
-require File.dirname(__FILE__) + '/assertions/selector_assertions'
-require File.dirname(__FILE__) + '/assertions/tag_assertions'
-require File.dirname(__FILE__) + '/assertions/dom_assertions'
-require File.dirname(__FILE__) + '/assertions/routing_assertions'
-require File.dirname(__FILE__) + '/assertions/model_assertions'
-
module Test #:nodoc:
module Unit #:nodoc:
class TestCase #:nodoc: