From 9598176390b624bece9c4e2f9aecb68e0cc95871 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 5 Sep 2006 21:28:22 +0000 Subject: [PATCH] Better bundling of new assertions and make integration tests work again git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5020 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/action_controller/assertions.rb | 33 +++++++++++-------- .../lib/action_controller/integration.rb | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/actionpack/lib/action_controller/assertions.rb b/actionpack/lib/action_controller/assertions.rb index 4eab8f9ffd..f3d4558e92 100644 --- a/actionpack/lib/action_controller/assertions.rb +++ b/actionpack/lib/action_controller/assertions.rb @@ -44,6 +44,24 @@ module ActionController #:nodoc: # # 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 + include ActionController::Assertions::DeprecatedAssertions + 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}/ } + end end end @@ -58,20 +76,7 @@ require File.dirname(__FILE__) + '/assertions/deprecated_assertions' module Test #:nodoc: module Unit #:nodoc: class TestCase #:nodoc: - include ActionController::Assertions::ResponseAssertions - include ActionController::Assertions::SelectorAssertions - include ActionController::Assertions::RoutingAssertions - include ActionController::Assertions::TagAssertions - include ActionController::Assertions::DomAssertions - include ActionController::Assertions::ModelAssertions - include ActionController::Assertions::DeprecatedAssertions - - def clean_backtrace(&block) - yield - rescue AssertionFailedError => e - path = File.expand_path(__FILE__) - raise AssertionFailedError, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ } - end + include ActionController::Assertions end end end \ No newline at end of file diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index 57872e8e8b..a7736de113 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -13,7 +13,7 @@ module ActionController # Typically, you will instantiate a new session using IntegrationTest#open_session, # rather than instantiating Integration::Session directly. class Session - include Test::Unit::Assertions + include ActionController::Assertions include ActionController::TestProcess # The integer HTTP status code of the last request.