mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Move controller assertions from base TestCase to AC:: and AV::TestCase
This commit is contained in:
parent
ebf14baa0e
commit
c82e8e1f48
26 changed files with 191 additions and 265 deletions
|
@ -1,4 +1,4 @@
|
|||
require 'active_support/test_case'
|
||||
require 'action_controller/test_case'
|
||||
require 'action_controller/dispatcher'
|
||||
require 'action_controller/test_process'
|
||||
|
||||
|
@ -16,7 +16,7 @@ module ActionController
|
|||
# rather than instantiating Integration::Session directly.
|
||||
class Session
|
||||
include Test::Unit::Assertions
|
||||
include ActionController::Assertions
|
||||
include ActionController::TestCase::Assertions
|
||||
include ActionController::TestProcess
|
||||
|
||||
# The integer HTTP status code of the last request.
|
||||
|
|
|
@ -1,20 +1,6 @@
|
|||
require 'active_support/test_case'
|
||||
|
||||
module ActionController
|
||||
class NonInferrableControllerError < ActionControllerError
|
||||
def initialize(name)
|
||||
@name = name
|
||||
super "Unable to determine the controller to test from #{name}. " +
|
||||
"You'll need to specify it using 'tests YourController' in your " +
|
||||
"test case definition. This could mean that #{inferred_controller_name} does not exist " +
|
||||
"or it contains syntax errors"
|
||||
end
|
||||
|
||||
def inferred_controller_name
|
||||
@name.sub(/Test$/, '')
|
||||
end
|
||||
end
|
||||
|
||||
# Superclass for ActionController functional tests. Functional tests allow you to
|
||||
# test a single controller action per test method. This should not be confused with
|
||||
# integration tests (see ActionController::IntegrationTest), which are more like
|
||||
|
@ -119,11 +105,22 @@ module ActionController
|
|||
#
|
||||
# assert_redirected_to page_url(:title => 'foo')
|
||||
class TestCase < ActiveSupport::TestCase
|
||||
module Assertions
|
||||
%w(response selector tag dom routing model).each do |kind|
|
||||
require "action_controller/assertions/#{kind}_assertions"
|
||||
include const_get("#{kind.camelize}Assertions")
|
||||
include ActionController::Assertions.const_get("#{kind.camelize}Assertions")
|
||||
end
|
||||
|
||||
def clean_backtrace(&block)
|
||||
yield
|
||||
rescue ActiveSupport::TestCase::Assertion => error
|
||||
framework_path = Regexp.new(File.expand_path("#{File.dirname(__FILE__)}/assertions"))
|
||||
error.backtrace.reject! { |line| File.expand_path(line) =~ framework_path }
|
||||
raise
|
||||
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
|
||||
# (bystepping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular
|
||||
# rescue_action process takes place. This means you can test your rescue_action code by setting remote_addr to something else
|
||||
|
@ -156,7 +153,7 @@ module ActionController
|
|||
end
|
||||
|
||||
def controller_class=(new_class)
|
||||
prepare_controller_class(new_class)
|
||||
prepare_controller_class(new_class) if new_class
|
||||
write_inheritable_attribute(:controller_class, new_class)
|
||||
end
|
||||
|
||||
|
@ -171,7 +168,7 @@ module ActionController
|
|||
def determine_default_controller_class(name)
|
||||
name.sub(/Test$/, '').constantize
|
||||
rescue NameError
|
||||
raise NonInferrableControllerError.new(name)
|
||||
nil
|
||||
end
|
||||
|
||||
def prepare_controller_class(new_class)
|
||||
|
@ -180,25 +177,23 @@ module ActionController
|
|||
end
|
||||
|
||||
def setup_controller_request_and_response
|
||||
@controller = self.class.controller_class.new
|
||||
@controller.request = @request = TestRequest.new
|
||||
@request = TestRequest.new
|
||||
@response = TestResponse.new
|
||||
|
||||
if klass = self.class.controller_class
|
||||
@controller ||= klass.new rescue nil
|
||||
end
|
||||
|
||||
if @controller
|
||||
@controller.request = @request
|
||||
@controller.params = {}
|
||||
@controller.send(:initialize_current_url)
|
||||
end
|
||||
end
|
||||
|
||||
# Cause the action to be rescued according to the regular rules for rescue_action when the visitor is not local
|
||||
def rescue_action_in_public!
|
||||
@request.remote_addr = '208.77.188.166' # example.com
|
||||
end
|
||||
|
||||
def clean_backtrace(&block)
|
||||
yield
|
||||
rescue Assertion => error
|
||||
framework_path = Regexp.new(File.expand_path("#{File.dirname(__FILE__)}/assertions"))
|
||||
error.backtrace.reject! { |line| File.expand_path(line) =~ framework_path }
|
||||
raise
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -462,9 +462,9 @@ module ActionController #:nodoc:
|
|||
html_document.find_all(conditions)
|
||||
end
|
||||
|
||||
def method_missing(selector, *args)
|
||||
if ActionController::Routing::Routes.named_routes.helpers.include?(selector)
|
||||
@controller.send(selector, *args)
|
||||
def method_missing(selector, *args, &block)
|
||||
if @controller && ActionController::Routing::Routes.named_routes.helpers.include?(selector)
|
||||
@controller.send(selector, *args, &block)
|
||||
else
|
||||
super
|
||||
end
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
require 'active_support/test_case'
|
||||
require 'action_controller/test_case'
|
||||
|
||||
module ActionView
|
||||
class TestCase < ActiveSupport::TestCase
|
||||
include ActionController::TestCase::Assertions
|
||||
|
||||
class_inheritable_accessor :helper_class
|
||||
@@helper_class = nil
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class ActiveRecordTestConnector
|
|||
end
|
||||
end
|
||||
|
||||
class ActiveRecordTestCase < ActiveSupport::TestCase
|
||||
class ActiveRecordTestCase < ActionController::TestCase
|
||||
# Set our fixture path
|
||||
if ActiveRecordTestConnector.able_to_connect
|
||||
self.fixture_path = [FIXTURE_LOAD_PATH]
|
||||
|
@ -96,8 +96,6 @@ class ActiveRecordTestCase < ActiveSupport::TestCase
|
|||
def run(*args)
|
||||
super if ActiveRecordTestConnector.connected
|
||||
end
|
||||
|
||||
def default_test; end
|
||||
end
|
||||
|
||||
ActiveRecordTestConnector.setup
|
||||
|
|
|
@ -49,13 +49,6 @@ end
|
|||
class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
|
||||
fixtures :developers, :projects, :developers_projects, :topics, :replies, :companies, :mascots
|
||||
|
||||
def setup
|
||||
@controller = RenderPartialWithRecordIdentificationController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
super
|
||||
end
|
||||
|
||||
def test_rendering_partial_with_has_many_and_belongs_to_association
|
||||
get :render_with_has_many_and_belongs_to_association
|
||||
assert_template 'projects/_project'
|
||||
|
|
|
@ -165,13 +165,11 @@ module Admin
|
|||
end
|
||||
|
||||
# a test case to exercise the new capabilities TestRequest & TestResponse
|
||||
class ActionPackAssertionsControllerTest < Test::Unit::TestCase
|
||||
class ActionPackAssertionsControllerTest < ActionController::TestCase
|
||||
# let's get this party started
|
||||
def setup
|
||||
ActionController::Routing::Routes.reload
|
||||
ActionController::Routing.use_controllers!(%w(action_pack_assertions admin/inner_module user content admin/user))
|
||||
@controller = ActionPackAssertionsController.new
|
||||
@request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
@ -235,13 +233,13 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
|
|||
map.connect ':controller/:action/:id'
|
||||
end
|
||||
process :redirect_to_named_route
|
||||
assert_raise(Test::Unit::AssertionFailedError) do
|
||||
assert_raise(ActiveSupport::TestCase::Assertion) do
|
||||
assert_redirected_to 'http://test.host/route_two'
|
||||
end
|
||||
assert_raise(Test::Unit::AssertionFailedError) do
|
||||
assert_raise(ActiveSupport::TestCase::Assertion) do
|
||||
assert_redirected_to :controller => 'action_pack_assertions', :action => 'nothing', :id => 'two'
|
||||
end
|
||||
assert_raise(Test::Unit::AssertionFailedError) do
|
||||
assert_raise(ActiveSupport::TestCase::Assertion) do
|
||||
assert_redirected_to route_two_url
|
||||
end
|
||||
end
|
||||
|
@ -410,7 +408,7 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
|
|||
|
||||
def test_assert_redirection_fails_with_incorrect_controller
|
||||
process :redirect_to_controller
|
||||
assert_raise(Test::Unit::AssertionFailedError) do
|
||||
assert_raise(ActiveSupport::TestCase::Assertion) do
|
||||
assert_redirected_to :controller => "action_pack_assertions", :action => "flash_me"
|
||||
end
|
||||
end
|
||||
|
@ -466,7 +464,7 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
|
|||
begin
|
||||
assert_valid assigns('record')
|
||||
assert false
|
||||
rescue Test::Unit::AssertionFailedError => e
|
||||
rescue ActiveSupport::TestCase::Assertion => e
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -475,7 +473,7 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
|
|||
get :index
|
||||
assert_response :success
|
||||
flunk 'Expected non-success response'
|
||||
rescue Test::Unit::AssertionFailedError => e
|
||||
rescue ActiveSupport::TestCase::Assertion => e
|
||||
assert e.message.include?('FAIL')
|
||||
end
|
||||
|
||||
|
@ -484,17 +482,15 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
|
|||
get :show
|
||||
assert_response :success
|
||||
flunk 'Expected non-success response'
|
||||
rescue Test::Unit::AssertionFailedError
|
||||
rescue ActiveSupport::TestCase::Assertion
|
||||
# success
|
||||
rescue
|
||||
flunk "assert_response failed to handle failure response with missing, but optional, exception."
|
||||
end
|
||||
end
|
||||
|
||||
class ActionPackHeaderTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@controller = ActionPackAssertionsController.new
|
||||
@request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
|
||||
end
|
||||
class ActionPackHeaderTest < ActionController::TestCase
|
||||
tests ActionPackAssertionsController
|
||||
|
||||
def test_rendering_xml_sets_content_type
|
||||
process :hello_xml_world
|
||||
|
|
|
@ -19,7 +19,18 @@ end
|
|||
|
||||
ActionMailer::Base.template_root = FIXTURE_LOAD_PATH
|
||||
|
||||
class AssertSelectTest < Test::Unit::TestCase
|
||||
class AssertSelectTest < ActionController::TestCase
|
||||
Assertion = ActiveSupport::TestCase::Assertion
|
||||
|
||||
class AssertSelectMailer < ActionMailer::Base
|
||||
def test(html)
|
||||
recipients "test <test@test.host>"
|
||||
from "test@test.host"
|
||||
subject "Test e-mail"
|
||||
part :content_type=>"text/html", :body=>html
|
||||
end
|
||||
end
|
||||
|
||||
class AssertSelectController < ActionController::Base
|
||||
def response_with=(content)
|
||||
@content = content
|
||||
|
@ -51,21 +62,9 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class AssertSelectMailer < ActionMailer::Base
|
||||
def test(html)
|
||||
recipients "test <test@test.host>"
|
||||
from "test@test.host"
|
||||
subject "Test e-mail"
|
||||
part :content_type=>"text/html", :body=>html
|
||||
end
|
||||
end
|
||||
|
||||
AssertionFailedError = Test::Unit::AssertionFailedError
|
||||
tests AssertSelectController
|
||||
|
||||
def setup
|
||||
@controller = AssertSelectController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
ActionMailer::Base.delivery_method = :test
|
||||
ActionMailer::Base.perform_deliveries = true
|
||||
ActionMailer::Base.deliveries = []
|
||||
|
@ -76,7 +75,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def assert_failure(message, &block)
|
||||
e = assert_raises(AssertionFailedError, &block)
|
||||
e = assert_raises(Assertion, &block)
|
||||
assert_match(message, e.message) if Regexp === message
|
||||
assert_equal(message, e.message) if String === message
|
||||
end
|
||||
|
@ -95,24 +94,24 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
def test_equality_true_false
|
||||
render_html %Q{<div id="1"></div><div id="2"></div>}
|
||||
assert_nothing_raised { assert_select "div" }
|
||||
assert_raises(AssertionFailedError) { assert_select "p" }
|
||||
assert_raises(Assertion) { assert_select "p" }
|
||||
assert_nothing_raised { assert_select "div", true }
|
||||
assert_raises(AssertionFailedError) { assert_select "p", true }
|
||||
assert_raises(AssertionFailedError) { assert_select "div", false }
|
||||
assert_raises(Assertion) { assert_select "p", true }
|
||||
assert_raises(Assertion) { assert_select "div", false }
|
||||
assert_nothing_raised { assert_select "p", false }
|
||||
end
|
||||
|
||||
def test_equality_string_and_regexp
|
||||
render_html %Q{<div id="1">foo</div><div id="2">foo</div>}
|
||||
assert_nothing_raised { assert_select "div", "foo" }
|
||||
assert_raises(AssertionFailedError) { assert_select "div", "bar" }
|
||||
assert_raises(Assertion) { assert_select "div", "bar" }
|
||||
assert_nothing_raised { assert_select "div", :text=>"foo" }
|
||||
assert_raises(AssertionFailedError) { assert_select "div", :text=>"bar" }
|
||||
assert_raises(Assertion) { assert_select "div", :text=>"bar" }
|
||||
assert_nothing_raised { assert_select "div", /(foo|bar)/ }
|
||||
assert_raises(AssertionFailedError) { assert_select "div", /foobar/ }
|
||||
assert_raises(Assertion) { assert_select "div", /foobar/ }
|
||||
assert_nothing_raised { assert_select "div", :text=>/(foo|bar)/ }
|
||||
assert_raises(AssertionFailedError) { assert_select "div", :text=>/foobar/ }
|
||||
assert_raises(AssertionFailedError) { assert_select "p", :text=>/foobar/ }
|
||||
assert_raises(Assertion) { assert_select "div", :text=>/foobar/ }
|
||||
assert_raises(Assertion) { assert_select "p", :text=>/foobar/ }
|
||||
end
|
||||
|
||||
def test_equality_of_html
|
||||
|
@ -120,17 +119,17 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
text = "\"This is not a big problem,\" he said."
|
||||
html = "<em>\"This is <strong>not</strong> a big problem,\"</em> he said."
|
||||
assert_nothing_raised { assert_select "p", text }
|
||||
assert_raises(AssertionFailedError) { assert_select "p", html }
|
||||
assert_raises(Assertion) { assert_select "p", html }
|
||||
assert_nothing_raised { assert_select "p", :html=>html }
|
||||
assert_raises(AssertionFailedError) { assert_select "p", :html=>text }
|
||||
assert_raises(Assertion) { assert_select "p", :html=>text }
|
||||
# No stripping for pre.
|
||||
render_html %Q{<pre>\n<em>"This is <strong>not</strong> a big problem,"</em> he said.\n</pre>}
|
||||
text = "\n\"This is not a big problem,\" he said.\n"
|
||||
html = "\n<em>\"This is <strong>not</strong> a big problem,\"</em> he said.\n"
|
||||
assert_nothing_raised { assert_select "pre", text }
|
||||
assert_raises(AssertionFailedError) { assert_select "pre", html }
|
||||
assert_raises(Assertion) { assert_select "pre", html }
|
||||
assert_nothing_raised { assert_select "pre", :html=>html }
|
||||
assert_raises(AssertionFailedError) { assert_select "pre", :html=>text }
|
||||
assert_raises(Assertion) { assert_select "pre", :html=>text }
|
||||
end
|
||||
|
||||
def test_counts
|
||||
|
@ -210,12 +209,12 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
assert_nothing_raised { assert_select "div", "bar" }
|
||||
assert_nothing_raised { assert_select "div", /\w*/ }
|
||||
assert_nothing_raised { assert_select "div", /\w*/, :count=>2 }
|
||||
assert_raises(AssertionFailedError) { assert_select "div", :text=>"foo", :count=>2 }
|
||||
assert_raises(Assertion) { assert_select "div", :text=>"foo", :count=>2 }
|
||||
assert_nothing_raised { assert_select "div", :html=>"<span>bar</span>" }
|
||||
assert_nothing_raised { assert_select "div", :html=>"<span>bar</span>" }
|
||||
assert_nothing_raised { assert_select "div", :html=>/\w*/ }
|
||||
assert_nothing_raised { assert_select "div", :html=>/\w*/, :count=>2 }
|
||||
assert_raises(AssertionFailedError) { assert_select "div", :html=>"<span>foo</span>", :count=>2 }
|
||||
assert_raises(Assertion) { assert_select "div", :html=>"<span>foo</span>", :count=>2 }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -323,7 +322,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
# Test that we fail if there is nothing to pick.
|
||||
def test_assert_select_rjs_fails_if_nothing_to_pick
|
||||
render_rjs { }
|
||||
assert_raises(AssertionFailedError) { assert_select_rjs }
|
||||
assert_raises(Assertion) { assert_select_rjs }
|
||||
end
|
||||
|
||||
def test_assert_select_rjs_with_unicode
|
||||
|
@ -338,10 +337,10 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
if str.respond_to?(:force_encoding)
|
||||
str.force_encoding(Encoding::UTF_8)
|
||||
assert_select str, /\343\203\201..\343\203\210/u
|
||||
assert_raises(AssertionFailedError) { assert_select str, /\343\203\201.\343\203\210/u }
|
||||
assert_raises(Assertion) { assert_select str, /\343\203\201.\343\203\210/u }
|
||||
else
|
||||
assert_select str, Regexp.new("\343\203\201..\343\203\210",0,'U')
|
||||
assert_raises(AssertionFailedError) { assert_select str, Regexp.new("\343\203\201.\343\203\210",0,'U') }
|
||||
assert_raises(Assertion) { assert_select str, Regexp.new("\343\203\201.\343\203\210",0,'U') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -365,7 +364,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
assert_select "div", 1
|
||||
assert_select "#3"
|
||||
end
|
||||
assert_raises(AssertionFailedError) { assert_select_rjs "test4" }
|
||||
assert_raises(Assertion) { assert_select_rjs "test4" }
|
||||
end
|
||||
|
||||
def test_assert_select_rjs_for_replace
|
||||
|
@ -383,7 +382,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
assert_select "div", 1
|
||||
assert_select "#1"
|
||||
end
|
||||
assert_raises(AssertionFailedError) { assert_select_rjs :replace, "test2" }
|
||||
assert_raises(Assertion) { assert_select_rjs :replace, "test2" }
|
||||
# Replace HTML.
|
||||
assert_select_rjs :replace_html do
|
||||
assert_select "div", 1
|
||||
|
@ -393,7 +392,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
assert_select "div", 1
|
||||
assert_select "#2"
|
||||
end
|
||||
assert_raises(AssertionFailedError) { assert_select_rjs :replace_html, "test1" }
|
||||
assert_raises(Assertion) { assert_select_rjs :replace_html, "test1" }
|
||||
end
|
||||
|
||||
def test_assert_select_rjs_for_chained_replace
|
||||
|
@ -411,7 +410,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
assert_select "div", 1
|
||||
assert_select "#1"
|
||||
end
|
||||
assert_raises(AssertionFailedError) { assert_select_rjs :chained_replace, "test2" }
|
||||
assert_raises(Assertion) { assert_select_rjs :chained_replace, "test2" }
|
||||
# Replace HTML.
|
||||
assert_select_rjs :chained_replace_html do
|
||||
assert_select "div", 1
|
||||
|
@ -421,7 +420,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
assert_select "div", 1
|
||||
assert_select "#2"
|
||||
end
|
||||
assert_raises(AssertionFailedError) { assert_select_rjs :replace_html, "test1" }
|
||||
assert_raises(Assertion) { assert_select_rjs :replace_html, "test1" }
|
||||
end
|
||||
|
||||
# Simple remove
|
||||
|
@ -440,7 +439,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
|
||||
assert_select_rjs :remove, "test1"
|
||||
|
||||
rescue Test::Unit::AssertionFailedError
|
||||
rescue Assertion
|
||||
assert_equal "No RJS statement that removes 'test1' was rendered.", $!.message
|
||||
end
|
||||
|
||||
|
@ -472,7 +471,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
|
||||
assert_select_rjs :show, "test1"
|
||||
|
||||
rescue Test::Unit::AssertionFailedError
|
||||
rescue Assertion
|
||||
assert_equal "No RJS statement that shows 'test1' was rendered.", $!.message
|
||||
end
|
||||
|
||||
|
@ -504,7 +503,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
|
||||
assert_select_rjs :hide, "test1"
|
||||
|
||||
rescue Test::Unit::AssertionFailedError
|
||||
rescue Assertion
|
||||
assert_equal "No RJS statement that hides 'test1' was rendered.", $!.message
|
||||
end
|
||||
|
||||
|
@ -536,7 +535,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
|
||||
assert_select_rjs :toggle, "test1"
|
||||
|
||||
rescue Test::Unit::AssertionFailedError
|
||||
rescue Assertion
|
||||
assert_equal "No RJS statement that toggles 'test1' was rendered.", $!.message
|
||||
end
|
||||
|
||||
|
@ -567,7 +566,7 @@ class AssertSelectTest < Test::Unit::TestCase
|
|||
assert_select "div", 1
|
||||
assert_select "#3"
|
||||
end
|
||||
assert_raises(AssertionFailedError) { assert_select_rjs :insert_html, "test1" }
|
||||
assert_raises(Assertion) { assert_select_rjs :insert_html, "test1" }
|
||||
end
|
||||
|
||||
# Positioned insert.
|
||||
|
@ -693,7 +692,7 @@ EOF
|
|||
#
|
||||
|
||||
def test_assert_select_email
|
||||
assert_raises(AssertionFailedError) { assert_select_email {} }
|
||||
assert_raises(Assertion) { assert_select_email {} }
|
||||
AssertSelectMailer.deliver_test "<div><p>foo</p><p>bar</p></div>"
|
||||
assert_select_email do
|
||||
assert_select "div:root" do
|
||||
|
|
|
@ -105,7 +105,7 @@ class ControllerInstanceTests < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
|
||||
class PerformActionTest < Test::Unit::TestCase
|
||||
class PerformActionTest < ActionController::TestCase
|
||||
class MockLogger
|
||||
attr_reader :logged
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class PageCachingTestController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
class PageCachingTest < Test::Unit::TestCase
|
||||
class PageCachingTest < ActionController::TestCase
|
||||
def setup
|
||||
ActionController::Base.perform_caching = true
|
||||
|
||||
|
@ -222,7 +222,7 @@ class ActionCachingMockController
|
|||
end
|
||||
end
|
||||
|
||||
class ActionCacheTest < Test::Unit::TestCase
|
||||
class ActionCacheTest < ActionController::TestCase
|
||||
def setup
|
||||
reset!
|
||||
FileUtils.mkdir_p(FILE_STORE_PATH)
|
||||
|
@ -469,7 +469,7 @@ class FragmentCachingTestController < ActionController::Base
|
|||
def some_action; end;
|
||||
end
|
||||
|
||||
class FragmentCachingTest < Test::Unit::TestCase
|
||||
class FragmentCachingTest < ActionController::TestCase
|
||||
def setup
|
||||
ActionController::Base.perform_caching = true
|
||||
@store = ActiveSupport::Cache::MemoryStore.new
|
||||
|
@ -601,7 +601,7 @@ class FunctionalCachingController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
class FunctionalFragmentCachingTest < Test::Unit::TestCase
|
||||
class FunctionalFragmentCachingTest < ActionController::TestCase
|
||||
def setup
|
||||
ActionController::Base.perform_caching = true
|
||||
@store = ActiveSupport::Cache::MemoryStore.new
|
||||
|
|
|
@ -69,12 +69,8 @@ class CalleeController < ActionController::Base
|
|||
def rescue_action(e) raise end
|
||||
end
|
||||
|
||||
class ComponentsTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@controller = CallerController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
class ComponentsTest < ActionController::TestCase
|
||||
tests CallerController
|
||||
|
||||
def test_calling_from_controller
|
||||
assert_deprecated do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class DeprecatedBaseMethodsTest < Test::Unit::TestCase
|
||||
class DeprecatedBaseMethodsTest < ActionController::TestCase
|
||||
class Target < ActionController::Base
|
||||
def home_url(greeting)
|
||||
"http://example.com/#{greeting}"
|
||||
|
@ -13,11 +13,7 @@ class DeprecatedBaseMethodsTest < Test::Unit::TestCase
|
|||
def rescue_action(e) raise e end
|
||||
end
|
||||
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
@controller = Target.new
|
||||
end
|
||||
tests Target
|
||||
|
||||
def test_log_error_silences_deprecation_warnings
|
||||
get :raises_name_error
|
||||
|
@ -25,6 +21,7 @@ class DeprecatedBaseMethodsTest < Test::Unit::TestCase
|
|||
assert_not_deprecated { @controller.send :log_error, e }
|
||||
end
|
||||
|
||||
if defined? Test::Unit::Error
|
||||
def test_assertion_failed_error_silences_deprecation_warnings
|
||||
get :raises_name_error
|
||||
rescue => e
|
||||
|
@ -32,3 +29,4 @@ class DeprecatedBaseMethodsTest < Test::Unit::TestCase
|
|||
assert_not_deprecated { error.message }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class SanitizerTest < Test::Unit::TestCase
|
||||
class SanitizerTest < ActionController::TestCase
|
||||
def setup
|
||||
@sanitizer = nil # used by assert_sanitizer
|
||||
end
|
||||
|
|
|
@ -34,11 +34,8 @@ end
|
|||
ActionView::Template::register_template_handler :mab,
|
||||
lambda { |template| template.source.inspect }
|
||||
|
||||
class LayoutAutoDiscoveryTest < Test::Unit::TestCase
|
||||
class LayoutAutoDiscoveryTest < ActionController::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
|
||||
@request.host = "www.nextangle.com"
|
||||
end
|
||||
|
||||
|
@ -98,12 +95,7 @@ class RendersNoLayoutController < LayoutTest
|
|||
end
|
||||
end
|
||||
|
||||
class LayoutSetInResponseTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
|
||||
class LayoutSetInResponseTest < ActionController::TestCase
|
||||
def test_layout_set_when_using_default_layout
|
||||
@controller = DefaultLayoutController.new
|
||||
get :hello
|
||||
|
@ -150,12 +142,7 @@ class SetsNonExistentLayoutFile < LayoutTest
|
|||
layout "nofile.rhtml"
|
||||
end
|
||||
|
||||
class LayoutExceptionRaised < Test::Unit::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
|
||||
class LayoutExceptionRaised < ActionController::TestCase
|
||||
def test_exception_raised_when_layout_file_not_found
|
||||
@controller = SetsNonExistentLayoutFile.new
|
||||
get :hello
|
||||
|
@ -170,12 +157,7 @@ class LayoutStatusIsRendered < LayoutTest
|
|||
end
|
||||
end
|
||||
|
||||
class LayoutStatusIsRenderedTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
|
||||
class LayoutStatusIsRenderedTest < ActionController::TestCase
|
||||
def test_layout_status_is_rendered
|
||||
@controller = LayoutStatusIsRendered.new
|
||||
get :hello
|
||||
|
@ -187,12 +169,7 @@ class LayoutSymlinkedTest < LayoutTest
|
|||
layout "symlinked/symlinked_layout"
|
||||
end
|
||||
|
||||
class LayoutSymlinkedIsRenderedTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
|
||||
class LayoutSymlinkedIsRenderedTest < ActionController::TestCase
|
||||
def test_symlinked_layout_is_rendered
|
||||
@controller = LayoutSymlinkedTest.new
|
||||
get :hello
|
||||
|
|
|
@ -162,13 +162,11 @@ class RespondToController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
class MimeControllerTest < Test::Unit::TestCase
|
||||
class MimeControllerTest < ActionController::TestCase
|
||||
tests RespondToController
|
||||
|
||||
def setup
|
||||
ActionController::Base.use_accept_header = true
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
|
||||
@controller = RespondToController.new
|
||||
@request.host = "www.example.com"
|
||||
end
|
||||
|
||||
|
@ -509,12 +507,10 @@ class SuperPostController < PostController
|
|||
end
|
||||
end
|
||||
|
||||
class MimeControllerLayoutsTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
class MimeControllerLayoutsTest < ActionController::TestCase
|
||||
tests PostController
|
||||
|
||||
@controller = PostController.new
|
||||
def setup
|
||||
@request.host = "www.example.com"
|
||||
end
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ end
|
|||
class Response::Nested < Response; end
|
||||
|
||||
uses_mocha 'polymorphic URL helpers' do
|
||||
class PolymorphicRoutesTest < Test::Unit::TestCase
|
||||
|
||||
class PolymorphicRoutesTest < ActiveSupport::TestCase
|
||||
include ActionController::PolymorphicRoutes
|
||||
|
||||
def setup
|
||||
|
|
|
@ -103,12 +103,8 @@ class RedirectController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
class RedirectTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@controller = RedirectController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
class RedirectTest < ActionController::TestCase
|
||||
tests RedirectController
|
||||
|
||||
def test_simple_redirect
|
||||
get :simple_redirect
|
||||
|
@ -256,12 +252,8 @@ module ModuleTest
|
|||
end
|
||||
end
|
||||
|
||||
class ModuleRedirectTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@controller = ModuleRedirectController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
class ModuleRedirectTest < ActionController::TestCase
|
||||
tests ModuleRedirectController
|
||||
|
||||
def test_simple_redirect
|
||||
get :simple_redirect
|
||||
|
|
|
@ -641,12 +641,10 @@ class TestController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
class RenderTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
@controller = TestController.new
|
||||
class RenderTest < ActionController::TestCase
|
||||
tests TestController
|
||||
|
||||
def setup
|
||||
# enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
|
||||
# a more accurate simulation of what happens in "real life".
|
||||
@controller.logger = Logger.new(nil)
|
||||
|
@ -1333,12 +1331,10 @@ class RenderTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class EtagRenderTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
@controller = TestController.new
|
||||
class EtagRenderTest < ActionController::TestCase
|
||||
tests TestController
|
||||
|
||||
def setup
|
||||
@request.host = "www.nextangle.com"
|
||||
@expected_bang_etag = etag_for(expand_key([:foo, 123]))
|
||||
end
|
||||
|
@ -1430,12 +1426,10 @@ class EtagRenderTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class LastModifiedRenderTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
@controller = TestController.new
|
||||
class LastModifiedRenderTest < ActionController::TestCase
|
||||
tests TestController
|
||||
|
||||
def setup
|
||||
@request.host = "www.nextangle.com"
|
||||
@last_modified = Time.now.utc.beginning_of_day.httpdate
|
||||
end
|
||||
|
@ -1487,12 +1481,10 @@ class LastModifiedRenderTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class RenderingLoggingTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
@controller = TestController.new
|
||||
class RenderingLoggingTest < ActionController::TestCase
|
||||
tests TestController
|
||||
|
||||
def setup
|
||||
@request.host = "www.nextangle.com"
|
||||
end
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ end
|
|||
|
||||
# OK let's get our test on
|
||||
|
||||
class RequestForgeryProtectionControllerTest < Test::Unit::TestCase
|
||||
class RequestForgeryProtectionControllerTest < ActionController::TestCase
|
||||
include RequestForgeryProtectionTests
|
||||
def setup
|
||||
@controller = RequestForgeryProtectionController.new
|
||||
|
@ -236,7 +236,7 @@ class RequestForgeryProtectionControllerTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class RequestForgeryProtectionWithoutSecretControllerTest < Test::Unit::TestCase
|
||||
class RequestForgeryProtectionWithoutSecretControllerTest < ActionController::TestCase
|
||||
def setup
|
||||
@controller = RequestForgeryProtectionWithoutSecretController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
|
@ -255,7 +255,7 @@ class RequestForgeryProtectionWithoutSecretControllerTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class CsrfCookieMonsterControllerTest < Test::Unit::TestCase
|
||||
class CsrfCookieMonsterControllerTest < ActionController::TestCase
|
||||
include RequestForgeryProtectionTests
|
||||
def setup
|
||||
@controller = CsrfCookieMonsterController.new
|
||||
|
@ -271,7 +271,7 @@ class CsrfCookieMonsterControllerTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class FreeCookieControllerTest < Test::Unit::TestCase
|
||||
class FreeCookieControllerTest < ActionController::TestCase
|
||||
def setup
|
||||
@controller = FreeCookieController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
|
@ -296,7 +296,7 @@ class FreeCookieControllerTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class SessionOffControllerTest < Test::Unit::TestCase
|
||||
class SessionOffControllerTest < ActionController::TestCase
|
||||
def setup
|
||||
@controller = SessionOffController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'abstract_unit'
|
||||
require 'action_controller/integration'
|
||||
|
||||
class RequestTest < Test::Unit::TestCase
|
||||
class RequestTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
ActionController::Base.relative_url_root = nil
|
||||
@request = ActionController::TestRequest.new
|
||||
|
@ -400,7 +400,7 @@ class RequestTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class UrlEncodedRequestParameterParsingTest < Test::Unit::TestCase
|
||||
class UrlEncodedRequestParameterParsingTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@query_string = "action=create_customer&full_name=David%20Heinemeier%20Hansson&customerId=1"
|
||||
@query_string_with_empty = "action=create_customer&full_name="
|
||||
|
@ -704,20 +704,20 @@ class UrlEncodedRequestParameterParsingTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class MultipartRequestParameterParsingTest < Test::Unit::TestCase
|
||||
class MultipartRequestParameterParsingTest < ActiveSupport::TestCase
|
||||
FIXTURE_PATH = File.dirname(__FILE__) + '/../fixtures/multipart'
|
||||
|
||||
def test_single_parameter
|
||||
params = process('single_parameter')
|
||||
params = parse_multipart('single_parameter')
|
||||
assert_equal({ 'foo' => 'bar' }, params)
|
||||
end
|
||||
|
||||
def test_bracketed_param
|
||||
assert_equal({ 'foo' => { 'baz' => 'bar'}}, process('bracketed_param'))
|
||||
assert_equal({ 'foo' => { 'baz' => 'bar'}}, parse_multipart('bracketed_param'))
|
||||
end
|
||||
|
||||
def test_text_file
|
||||
params = process('text_file')
|
||||
params = parse_multipart('text_file')
|
||||
assert_equal %w(file foo), params.keys.sort
|
||||
assert_equal 'bar', params['foo']
|
||||
|
||||
|
@ -729,7 +729,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_boundary_problem_file
|
||||
params = process('boundary_problem_file')
|
||||
params = parse_multipart('boundary_problem_file')
|
||||
assert_equal %w(file foo), params.keys.sort
|
||||
|
||||
file = params['file']
|
||||
|
@ -748,7 +748,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_large_text_file
|
||||
params = process('large_text_file')
|
||||
params = parse_multipart('large_text_file')
|
||||
assert_equal %w(file foo), params.keys.sort
|
||||
assert_equal 'bar', params['foo']
|
||||
|
||||
|
@ -774,7 +774,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_binary_file
|
||||
params = process('binary_file')
|
||||
params = parse_multipart('binary_file')
|
||||
assert_equal %w(file flowers foo), params.keys.sort
|
||||
assert_equal 'bar', params['foo']
|
||||
|
||||
|
@ -793,7 +793,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_mixed_files
|
||||
params = process('mixed_files')
|
||||
params = parse_multipart('mixed_files')
|
||||
assert_equal %w(files foo), params.keys.sort
|
||||
assert_equal 'bar', params['foo']
|
||||
|
||||
|
@ -805,7 +805,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
private
|
||||
def process(name)
|
||||
def parse_multipart(name)
|
||||
File.open(File.join(FIXTURE_PATH, name), 'rb') do |file|
|
||||
params = ActionController::AbstractRequest.parse_multipart_form_parameters(file, 'AaB03x', file.stat.size, {})
|
||||
assert_equal 0, file.pos # file was rewound after reading
|
||||
|
@ -814,7 +814,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class XmlParamsParsingTest < Test::Unit::TestCase
|
||||
class XmlParamsParsingTest < ActiveSupport::TestCase
|
||||
def test_hash_params
|
||||
person = parse_body("<person><name>David</name></person>")[:person]
|
||||
assert_kind_of Hash, person
|
||||
|
@ -868,7 +868,7 @@ class LegacyXmlParamsParsingTest < XmlParamsParsingTest
|
|||
end
|
||||
end
|
||||
|
||||
class JsonParamsParsingTest < Test::Unit::TestCase
|
||||
class JsonParamsParsingTest < ActiveSupport::TestCase
|
||||
def test_hash_params_for_application_json
|
||||
person = parse_body({:person => {:name => "David"}}.to_json,'application/json')[:person]
|
||||
assert_kind_of Hash, person
|
||||
|
|
|
@ -27,7 +27,7 @@ module Backoffice
|
|||
end
|
||||
end
|
||||
|
||||
class ResourcesTest < Test::Unit::TestCase
|
||||
class ResourcesTest < ActionController::TestCase
|
||||
# The assertions in these tests are incompatible with the hash method
|
||||
# optimisation. This could indicate user level problems
|
||||
def setup
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'abstract_unit'
|
||||
require 'controller/fake_controllers'
|
||||
|
||||
class TestTest < Test::Unit::TestCase
|
||||
class TestTest < ActionController::TestCase
|
||||
class TestController < ActionController::Base
|
||||
def no_op
|
||||
render :text => 'dummy'
|
||||
|
@ -24,7 +24,7 @@ class TestTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def render_raw_post
|
||||
raise Test::Unit::AssertionFailedError, "#raw_post is blank" if request.raw_post.blank?
|
||||
raise ActiveSupport::TestCase::Assertion, "#raw_post is blank" if request.raw_post.blank?
|
||||
render :text => request.raw_post
|
||||
end
|
||||
|
||||
|
@ -580,7 +580,7 @@ XML
|
|||
assert_equal @response.redirect_url, redirect_to_url
|
||||
|
||||
# Must be a :redirect response.
|
||||
assert_raise(Test::Unit::AssertionFailedError) do
|
||||
assert_raise(ActiveSupport::TestCase::Assertion) do
|
||||
assert_redirected_to 'created resource'
|
||||
end
|
||||
end
|
||||
|
@ -602,9 +602,9 @@ XML
|
|||
end
|
||||
end
|
||||
|
||||
class CleanBacktraceTest < Test::Unit::TestCase
|
||||
class CleanBacktraceTest < ActionController::TestCase
|
||||
def test_should_reraise_the_same_object
|
||||
exception = Test::Unit::AssertionFailedError.new('message')
|
||||
exception = ActiveSupport::TestCase::Assertion.new('message')
|
||||
clean_backtrace { raise exception }
|
||||
rescue => caught
|
||||
assert_equal exception.object_id, caught.object_id
|
||||
|
@ -613,7 +613,7 @@ class CleanBacktraceTest < Test::Unit::TestCase
|
|||
|
||||
def test_should_clean_assertion_lines_from_backtrace
|
||||
path = File.expand_path("#{File.dirname(__FILE__)}/../../lib/action_controller")
|
||||
exception = Test::Unit::AssertionFailedError.new('message')
|
||||
exception = ActiveSupport::TestCase::Assertion.new('message')
|
||||
exception.set_backtrace ["#{path}/abc", "#{path}/assertions/def"]
|
||||
clean_backtrace { raise exception }
|
||||
rescue => caught
|
||||
|
@ -629,21 +629,17 @@ class CleanBacktraceTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class InferringClassNameTest < Test::Unit::TestCase
|
||||
class InferringClassNameTest < ActionController::TestCase
|
||||
def test_determine_controller_class
|
||||
assert_equal ContentController, determine_class("ContentControllerTest")
|
||||
end
|
||||
|
||||
def test_determine_controller_class_with_nonsense_name
|
||||
assert_raises ActionController::NonInferrableControllerError do
|
||||
determine_class("HelloGoodBye")
|
||||
end
|
||||
assert_nil determine_class("HelloGoodBye")
|
||||
end
|
||||
|
||||
def test_determine_controller_class_with_sensible_name_where_no_controller_exists
|
||||
assert_raises ActionController::NonInferrableControllerError do
|
||||
determine_class("NoControllerWithThisNameTest")
|
||||
end
|
||||
assert_nil determine_class("NoControllerWithThisNameTest")
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'abstract_unit'
|
|||
|
||||
ActionController::UrlRewriter
|
||||
|
||||
class UrlRewriterTests < Test::Unit::TestCase
|
||||
class UrlRewriterTests < ActionController::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@params = {}
|
||||
|
@ -85,8 +85,7 @@ class UrlRewriterTests < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class UrlWriterTests < Test::Unit::TestCase
|
||||
|
||||
class UrlWriterTests < ActionController::TestCase
|
||||
class W
|
||||
include ActionController::UrlWriter
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class VerificationTest < Test::Unit::TestCase
|
||||
class VerificationTest < ActionController::TestCase
|
||||
class TestController < ActionController::Base
|
||||
verify :only => :guarded_one, :params => "one",
|
||||
:add_flash => { :error => 'unguarded' },
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class ViewLoadPathsTest < Test::Unit::TestCase
|
||||
class ViewLoadPathsTest < ActionController::TestCase
|
||||
class TestController < ActionController::Base
|
||||
def self.controller_path() "test" end
|
||||
def rescue_action(e) raise end
|
||||
|
|
|
@ -166,12 +166,10 @@ class ScrollsController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
class AtomFeedTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
@controller = ScrollsController.new
|
||||
class AtomFeedTest < ActionController::TestCase
|
||||
tests ScrollsController
|
||||
|
||||
def setup
|
||||
@request.host = "www.nextangle.com"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue