Skip to content

Commit

Permalink
Remove deprecated stuff in ActionController
Browse files Browse the repository at this point in the history
This removes all deprecated classes in ActionController related to
Routing, Abstract Request/Response and Integration/IntegrationTest.
All tests and docs were changed to ActionDispatch instead of ActionController.
  • Loading branch information
carlosantoniodasilva authored and josevalim committed Sep 25, 2010
1 parent ff3f55e commit 7fc1edd
Show file tree
Hide file tree
Showing 29 changed files with 47 additions and 58 deletions.
5 changes: 0 additions & 5 deletions actionpack/lib/action_controller.rb
Expand Up @@ -34,11 +34,6 @@ module ActionController
autoload :UrlFor
end

autoload :Integration, 'action_controller/deprecated/integration_test'
autoload :IntegrationTest, 'action_controller/deprecated/integration_test'
autoload :PerformanceTest, 'action_controller/deprecated/performance_test'
autoload :UrlWriter, 'action_controller/deprecated'
autoload :Routing, 'action_controller/deprecated'
autoload :TestCase, 'action_controller/test_case'

eager_autoload do
Expand Down
3 changes: 0 additions & 3 deletions actionpack/lib/action_controller/deprecated.rb

This file was deleted.

This file was deleted.

This file was deleted.

Expand Up @@ -417,7 +417,7 @@ def authenticate(controller, &login_procedure)
# Authorization: Token token="abc", nonce="def"
# Then the returned token is "abc", and the options is {:nonce => "def"}
#
# request - ActionController::Request instance with the current headers.
# request - ActionDispatch::Request instance with the current headers.
#
# Returns an Array of [String, Hash] if a token is present.
# Returns nil if no token is found.
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/test_case.rb
Expand Up @@ -200,7 +200,7 @@ def exists?; true; 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
# integration tests (see ActionDispatch::IntegrationTest), which are more like
# "stories" that can involve multiple controllers and multiple actions (i.e. multiple
# different HTTP requests).
#
Expand Down
1 change: 1 addition & 0 deletions actionpack/lib/action_dispatch.rb
Expand Up @@ -85,6 +85,7 @@ module Session
autoload_under 'testing' do
autoload :Assertions
autoload :Integration
autoload :IntegrationTest, 'action_dispatch/testing/integration'
autoload :PerformanceTest
autoload :TestProcess
autoload :TestRequest
Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_dispatch/testing/integration.rb
Expand Up @@ -385,7 +385,7 @@ def method_missing(sym, *args, &block)
#
# require "test_helper"
#
# class ExampleTest < ActionController::IntegrationTest
# class ExampleTest < ActionDispatch::IntegrationTest
# fixtures :people
#
# def test_login
Expand All @@ -409,7 +409,7 @@ def method_missing(sym, *args, &block)
#
# require "test_helper"
#
# class AdvancedTest < ActionController::IntegrationTest
# class AdvancedTest < ActionDispatch::IntegrationTest
# fixtures :people, :rooms
#
# def test_login_and_speak
Expand Down
6 changes: 2 additions & 4 deletions actionpack/test/abstract_unit.rb
Expand Up @@ -124,7 +124,7 @@ class TestCase
match ':controller(/:action)'
end

ActionController::IntegrationTest.app.routes.draw do
ActionDispatch::IntegrationTest.app.routes.draw do
match ':controller(/:action)'
end
end
Expand Down Expand Up @@ -163,9 +163,7 @@ class ActionDispatch::IntegrationTest < ActiveSupport::TestCase
setup do
@routes = SharedTestRoutes
end
end

class ActionController::IntegrationTest < ActiveSupport::TestCase
def self.build_app(routes = nil)
RoutedRackApp.new(routes || ActionDispatch::Routing::RouteSet.new) do |middleware|
middleware.use "ActionDispatch::ShowExceptions"
Expand Down Expand Up @@ -232,7 +230,7 @@ def with_autoload_path(path)
end

# Temporary base class
class Rack::TestCase < ActionController::IntegrationTest
class Rack::TestCase < ActionDispatch::IntegrationTest
def self.testing(klass = nil)
if klass
@testing = "/#{klass.name.underscore}".sub!(/_controller$/, '')
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/activerecord/active_record_store_test.rb
@@ -1,6 +1,6 @@
require 'active_record_unit'

class ActiveRecordStoreTest < ActionController::IntegrationTest
class ActiveRecordStoreTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
def no_session_access
head :ok
Expand Down
3 changes: 2 additions & 1 deletion actionpack/test/controller/filters_test.rb
Expand Up @@ -452,13 +452,14 @@ def show
render :text => 'hello world'
end
end

def test_sweeper_should_not_block_rendering
response = test_process(SweeperTestController)
assert_equal 'hello world', response.body
end

def test_before_method_of_sweeper_should_always_return_true
sweeper = ActionController::Caching::Sweeper.send(:new)
sweeper = ActionController::Caching::Sweeper.send(:new)
assert sweeper.before(TestController.new)
end

Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/flash_test.rb
Expand Up @@ -209,7 +209,7 @@ def test_redirect_to_with_other_flashes
end
end

class FlashIntegrationTest < ActionController::IntegrationTest
class FlashIntegrationTest < ActionDispatch::IntegrationTest
SessionKey = '_myapp_session'
SessionSecret = 'b3c631c314c0bbca50c1b2843150fe33'

Expand Down
12 changes: 6 additions & 6 deletions actionpack/test/controller/integration_test.rb
Expand Up @@ -8,7 +8,7 @@ class SessionTest < Test::Unit::TestCase
}

def setup
@session = ActionController::Integration::Session.new(StubApp)
@session = ActionDispatch::Integration::Session.new(StubApp)
end

def test_https_bang_works_and_sets_truth_by_default
Expand Down Expand Up @@ -167,7 +167,7 @@ def test_xml_http_request_override_accept

class IntegrationTestTest < Test::Unit::TestCase
def setup
@test = ::ActionController::IntegrationTest.new(:default_test)
@test = ::ActionDispatch::IntegrationTest.new(:default_test)
@test.class.stubs(:fixture_table_names).returns([])
@session = @test.open_session
end
Expand Down Expand Up @@ -202,7 +202,7 @@ def method_missing(name, *args)

# Tests that integration tests don't call Controller test methods for processing.
# Integration tests have their own setup and teardown.
class IntegrationTestUsesCorrectClass < ActionController::IntegrationTest
class IntegrationTestUsesCorrectClass < ActionDispatch::IntegrationTest
def self.fixture_table_names
[]
end
Expand All @@ -218,7 +218,7 @@ def test_integration_methods_called
end
end

class IntegrationProcessTest < ActionController::IntegrationTest
class IntegrationProcessTest < ActionDispatch::IntegrationTest
class IntegrationController < ActionController::Base
def get
respond_to do |format|
Expand Down Expand Up @@ -439,7 +439,7 @@ def with_test_route_set
end
end

class MetalIntegrationTest < ActionController::IntegrationTest
class MetalIntegrationTest < ActionDispatch::IntegrationTest
include SharedTestRoutes.url_helpers

class Poller
Expand Down Expand Up @@ -476,7 +476,7 @@ def test_generate_url_without_controller
end
end

class ApplicationIntegrationTest < ActionController::IntegrationTest
class ApplicationIntegrationTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
def index
render :text => "index"
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/rescue_test.rb
Expand Up @@ -311,7 +311,7 @@ def test_block_rescue_handler_with_argument_as_string
end
end

class RescueTest < ActionController::IntegrationTest
class RescueTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
class RecordInvalid < StandardError
def message
Expand Down
14 changes: 7 additions & 7 deletions actionpack/test/controller/routing_test.rb
Expand Up @@ -10,12 +10,12 @@ def index() head :ok end
def rescue_action(e) raise e end
end

ROUTING = ActionController::Routing
ROUTING = ActionDispatch::Routing

# See RFC 3986, section 3.3 for allowed path characters.
class UriReservedCharactersRoutingTest < Test::Unit::TestCase
def setup
@set = ActionController::Routing::RouteSet.new
@set = ActionDispatch::Routing::RouteSet.new
@set.draw do
match ':controller/:action/:variable/*additional'
end
Expand Down Expand Up @@ -71,7 +71,7 @@ class LegacyRouteSetTests < Test::Unit::TestCase
attr_reader :rs

def setup
@rs = ::ActionController::Routing::RouteSet.new
@rs = ::ActionDispatch::Routing::RouteSet.new
end

def teardown
Expand Down Expand Up @@ -103,7 +103,7 @@ def test_ignores_leading_slash

def test_time_recognition
# We create many routes to make situation more realistic
@rs = ::ActionController::Routing::RouteSet.new
@rs = ::ActionDispatch::Routing::RouteSet.new
@rs.draw {
root :to => "search#new", :as => "frontpage"
resources :videos do
Expand Down Expand Up @@ -581,7 +581,7 @@ def test_failed_constraints_raises_exception_with_violated_constraints
end

def test_routes_changed_correctly_after_clear
rs = ::ActionController::Routing::RouteSet.new
rs = ::ActionDispatch::Routing::RouteSet.new
rs.draw do
match 'ca' => 'ca#aa'
match 'cb' => 'cb#ab'
Expand Down Expand Up @@ -1516,7 +1516,7 @@ class RackMountIntegrationTests < ActiveSupport::TestCase
end

match '/blog(/:year(/:month(/:day)))' => 'posts#show_date',
:constraints => {
:constraints => {
:year => /(19|20)\d\d/,
:month => /[01]?\d/,
:day => /[0-3]?\d/
Expand Down Expand Up @@ -1559,7 +1559,7 @@ class RackMountIntegrationTests < ActiveSupport::TestCase
}

def setup
@routes = ActionController::Routing::RouteSet.new
@routes = ActionDispatch::Routing::RouteSet.new
@routes.draw(&Mapping)
end

Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/webservice_test.rb
@@ -1,6 +1,6 @@
require 'abstract_unit'

class WebServiceTest < ActionController::IntegrationTest
class WebServiceTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
def assign_parameters
if params[:full]
Expand Down
@@ -1,6 +1,6 @@
require 'abstract_unit'

class JsonParamsParsingTest < ActionController::IntegrationTest
class JsonParamsParsingTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
class << self
attr_accessor :last_request_parameters
Expand Down
@@ -1,6 +1,6 @@
require 'abstract_unit'

class MultipartParamsParsingTest < ActionController::IntegrationTest
class MultipartParamsParsingTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
class << self
attr_accessor :last_request_parameters
Expand Down
@@ -1,6 +1,6 @@
require 'abstract_unit'

class QueryStringParsingTest < ActionController::IntegrationTest
class QueryStringParsingTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
class << self
attr_accessor :last_query_parameters
Expand Down
@@ -1,6 +1,6 @@
require 'abstract_unit'

class UrlEncodedParamsParsingTest < ActionController::IntegrationTest
class UrlEncodedParamsParsingTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
class << self
attr_accessor :last_request_parameters, :last_request_type
Expand Down
@@ -1,6 +1,6 @@
require 'abstract_unit'

class XmlParamsParsingTest < ActionController::IntegrationTest
class XmlParamsParsingTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
class << self
attr_accessor :last_request_parameters
Expand Down
6 changes: 3 additions & 3 deletions actionpack/test/dispatch/routing_test.rb
Expand Up @@ -463,7 +463,7 @@ def self.matches?(request)
end
end

class TestAltApp < ActionController::IntegrationTest
class TestAltApp < ActionDispatch::IntegrationTest
class AltRequest
def initialize(env)
@env = env
Expand Down Expand Up @@ -2184,7 +2184,7 @@ def expected_redirect_body(url)
end
end

class TestAppendingRoutes < ActionController::IntegrationTest
class TestAppendingRoutes < ActionDispatch::IntegrationTest
def simple_app(resp)
lambda { |e| [ 200, { 'Content-Type' => 'text/plain' }, [resp] ] }
end
Expand Down Expand Up @@ -2218,7 +2218,7 @@ def test_missing_routes_are_still_missing
end
end

class TestDefaultScope < ActionController::IntegrationTest
class TestDefaultScope < ActionDispatch::IntegrationTest
module ::Blog
class PostsController < ActionController::Base
def index
Expand Down
6 changes: 3 additions & 3 deletions actionpack/test/dispatch/session/cookie_store_test.rb
@@ -1,7 +1,7 @@
require 'abstract_unit'
require 'stringio'

class CookieStoreTest < ActionController::IntegrationTest
class CookieStoreTest < ActionDispatch::IntegrationTest
SessionKey = '_myapp_session'
SessionSecret = 'b3c631c314c0bbca50c1b2843150fe33'

Expand Down Expand Up @@ -105,15 +105,15 @@ def test_disregards_tampered_sessions
assert_equal 'foo: nil', response.body
end
end

def test_does_not_set_secure_cookies_over_http
with_test_route_set(:secure => true) do
get '/set_session_value'
assert_response :success
assert_equal nil, headers['Set-Cookie']
end
end

def test_does_set_secure_cookies_over_https
with_test_route_set(:secure => true) do
get '/set_session_value', nil, 'HTTPS' => 'on'
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/dispatch/session/mem_cache_store_test.rb
@@ -1,7 +1,7 @@
require 'abstract_unit'

# You need to start a memcached server inorder to run these tests
class MemCacheStoreTest < ActionController::IntegrationTest
class MemCacheStoreTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
def no_session_access
head :ok
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/dispatch/show_exceptions_test.rb
Expand Up @@ -14,7 +14,7 @@ def logger
end
end

class ShowExceptionsTest < ActionController::IntegrationTest
class ShowExceptionsTest < ActionDispatch::IntegrationTest
Boomer = lambda do |env|
req = ActionDispatch::Request.new(env)
case req.path
Expand Down

0 comments on commit 7fc1edd

Please sign in to comment.