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
上级 85fbb22f
......@@ -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 @@ module 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
......@@ -13,7 +13,7 @@ module Integration #:nodoc:
# 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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册