提交 7b3b7cb2 编写于 作者: J Joshua Peek

Move generic assertions into ActionDispatch

上级 98dd7266
...@@ -14,7 +14,7 @@ module Integration #:nodoc: ...@@ -14,7 +14,7 @@ module Integration #:nodoc:
# Integration::Session directly. # Integration::Session directly.
class Session class Session
include Test::Unit::Assertions include Test::Unit::Assertions
include ActionController::TestCase::Assertions include ActionDispatch::Assertions
include ActionController::TestProcess include ActionController::TestProcess
# The integer HTTP status code of the last request. # The integer HTTP status code of the last request.
......
...@@ -105,12 +105,7 @@ module ActionController ...@@ -105,12 +105,7 @@ module ActionController
class TestCase < ActiveSupport::TestCase class TestCase < ActiveSupport::TestCase
include TestProcess include TestProcess
module Assertions include ActionDispatch::Assertions
%w(response selector tag dom routing model).each do |kind|
include ActionController::Assertions.const_get("#{kind.camelize}Assertions")
end
end
include Assertions
# When the request.remote_addr remains the default for testing, which is 0.0.0.0, the exception is simply raised inline # When the request.remote_addr remains the default for testing, which is 0.0.0.0, the exception is simply raised inline
# (bystepping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular # (bystepping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular
......
...@@ -45,6 +45,8 @@ module ActionDispatch ...@@ -45,6 +45,8 @@ module ActionDispatch
autoload :Reloader, 'action_dispatch/middleware/reloader' autoload :Reloader, 'action_dispatch/middleware/reloader'
autoload :MiddlewareStack, 'action_dispatch/middleware/stack' autoload :MiddlewareStack, 'action_dispatch/middleware/stack'
autoload :Assertions, 'action_dispatch/testing/assertions'
module Http module Http
autoload :Headers, 'action_dispatch/http/headers' autoload :Headers, 'action_dispatch/http/headers'
end end
......
module ActionDispatch
module Assertions
%w(response selector tag dom routing model).each do |kind|
require "action_dispatch/testing/assertions/#{kind}"
include const_get("#{kind.camelize}Assertions")
end
end
end
module ActionController module ActionDispatch
module Assertions module Assertions
module DomAssertions module DomAssertions
# Test two HTML strings for equivalency (e.g., identical up to reordering of attributes) # Test two HTML strings for equivalency (e.g., identical up to reordering of attributes)
......
module ActionController module ActionDispatch
module Assertions module Assertions
module ModelAssertions module ModelAssertions
# Ensures that the passed record is valid by Active Record standards and # Ensures that the passed record is valid by Active Record standards and
......
module ActionController module ActionDispatch
module Assertions module Assertions
# A small suite of assertions that test responses from Rails applications. # A small suite of assertions that test responses from Rails applications.
module ResponseAssertions module ResponseAssertions
......
module ActionController module ActionDispatch
module Assertions module Assertions
# Suite of assertions to test routes generated by Rails and the handling of requests made to them. # Suite of assertions to test routes generated by Rails and the handling of requests made to them.
module RoutingAssertions module RoutingAssertions
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Under MIT and/or CC By license. # Under MIT and/or CC By license.
#++ #++
module ActionController module ActionDispatch
module Assertions module Assertions
unless const_defined?(:NO_STRIP) unless const_defined?(:NO_STRIP)
NO_STRIP = %w{pre script style textarea} NO_STRIP = %w{pre script style textarea}
......
module ActionController module ActionDispatch
module Assertions module Assertions
# Pair of assertions to testing elements in the HTML output of the response. # Pair of assertions to testing elements in the HTML output of the response.
module TagAssertions module TagAssertions
......
...@@ -21,7 +21,7 @@ def _render_template(template, local_assigns = {}) ...@@ -21,7 +21,7 @@ def _render_template(template, local_assigns = {})
end end
class TestCase < ActiveSupport::TestCase class TestCase < ActiveSupport::TestCase
include ActionController::TestCase::Assertions include ActionDispatch::Assertions
include ActionController::TestProcess include ActionController::TestProcess
class_inheritable_accessor :helper_class class_inheritable_accessor :helper_class
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册