From 4ac332fa9a16ae86b948251e372999b9f4618dec Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 28 Jan 2007 07:10:35 +0000 Subject: Fix Test::Unit::TestCase#clean_backtrace git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6056 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/assertions.rb | 28 +++++++++----------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'actionpack/lib/action_controller/assertions.rb') 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: -- cgit v1.2.3