1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
David Heinemeier Hansson 2006-09-05 21:28:22 +00:00
parent 85fbb22f07
commit 9598176390
2 changed files with 20 additions and 15 deletions

View file

@ -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

View file

@ -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.