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

Move generic assertions into ActionDispatch

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