mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
More Action Pack abstract_unit
cleanup (#25211)
- Remove dead classes / dead code - Move class definitions to where they are used, don't define in a shared space
This commit is contained in:
parent
e4fc16a545
commit
81251c6d99
4 changed files with 23 additions and 28 deletions
|
@ -34,7 +34,6 @@ require 'action_dispatch'
|
||||||
require 'active_support/dependencies'
|
require 'active_support/dependencies'
|
||||||
require 'active_model'
|
require 'active_model'
|
||||||
require 'active_record'
|
require 'active_record'
|
||||||
require 'action_controller/caching'
|
|
||||||
|
|
||||||
require 'pp' # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late
|
require 'pp' # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late
|
||||||
|
|
||||||
|
@ -58,10 +57,6 @@ ActiveSupport::Deprecation.debug = true
|
||||||
# Disable available locale checks to avoid warnings running the test suite.
|
# Disable available locale checks to avoid warnings running the test suite.
|
||||||
I18n.enforce_available_locales = false
|
I18n.enforce_available_locales = false
|
||||||
|
|
||||||
# Register danish language for testing
|
|
||||||
I18n.backend.store_translations 'da', {}
|
|
||||||
I18n.backend.store_translations 'pt-BR', {}
|
|
||||||
|
|
||||||
FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), 'fixtures')
|
FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), 'fixtures')
|
||||||
|
|
||||||
SharedTestRoutes = ActionDispatch::Routing::RouteSet.new
|
SharedTestRoutes = ActionDispatch::Routing::RouteSet.new
|
||||||
|
@ -359,37 +354,15 @@ module RoutingTestHelpers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class MetalRenderingController < ActionController::Metal
|
|
||||||
include AbstractController::Rendering
|
|
||||||
include ActionController::Rendering
|
|
||||||
include ActionController::Renderers
|
|
||||||
end
|
|
||||||
|
|
||||||
class ResourcesController < ActionController::Base
|
class ResourcesController < ActionController::Base
|
||||||
def index() head :ok end
|
def index() head :ok end
|
||||||
alias_method :show, :index
|
alias_method :show, :index
|
||||||
end
|
end
|
||||||
|
|
||||||
class ThreadsController < ResourcesController; end
|
|
||||||
class MessagesController < ResourcesController; end
|
|
||||||
class CommentsController < ResourcesController; end
|
class CommentsController < ResourcesController; end
|
||||||
class ReviewsController < ResourcesController; end
|
|
||||||
|
|
||||||
class AccountsController < ResourcesController; end
|
class AccountsController < ResourcesController; end
|
||||||
class AdminController < ResourcesController; end
|
|
||||||
class ProductsController < ResourcesController; end
|
|
||||||
class ImagesController < ResourcesController; end
|
class ImagesController < ResourcesController; end
|
||||||
|
|
||||||
module Backoffice
|
|
||||||
class ProductsController < ResourcesController; end
|
|
||||||
class ImagesController < ResourcesController; end
|
|
||||||
|
|
||||||
module Admin
|
|
||||||
class ProductsController < ResourcesController; end
|
|
||||||
class ImagesController < ResourcesController; end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Skips the current run on Rubinius using Minitest::Assertions#skip
|
# Skips the current run on Rubinius using Minitest::Assertions#skip
|
||||||
def rubinius_skip(message = '')
|
def rubinius_skip(message = '')
|
||||||
skip message if RUBY_ENGINE == 'rbx'
|
skip message if RUBY_ENGINE == 'rbx'
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
require 'abstract_unit'
|
require 'abstract_unit'
|
||||||
require 'active_support/core_ext/hash/conversions'
|
require 'active_support/core_ext/hash/conversions'
|
||||||
|
|
||||||
|
class MetalRenderingController < ActionController::Metal
|
||||||
|
include AbstractController::Rendering
|
||||||
|
include ActionController::Rendering
|
||||||
|
include ActionController::Renderers
|
||||||
|
end
|
||||||
|
|
||||||
class MetalRenderingJsonController < MetalRenderingController
|
class MetalRenderingJsonController < MetalRenderingController
|
||||||
class Model
|
class Model
|
||||||
def to_json(options = {})
|
def to_json(options = {})
|
||||||
|
|
|
@ -3,8 +3,22 @@ require 'active_support/core_ext/object/try'
|
||||||
require 'active_support/core_ext/object/with_options'
|
require 'active_support/core_ext/object/with_options'
|
||||||
require 'active_support/core_ext/array/extract_options'
|
require 'active_support/core_ext/array/extract_options'
|
||||||
|
|
||||||
class ResourcesTest < ActionController::TestCase
|
class AdminController < ResourcesController; end
|
||||||
|
class MessagesController < ResourcesController; end
|
||||||
|
class ProductsController < ResourcesController; end
|
||||||
|
class ThreadsController < ResourcesController; end
|
||||||
|
|
||||||
|
module Backoffice
|
||||||
|
class ProductsController < ResourcesController; end
|
||||||
|
class ImagesController < ResourcesController; end
|
||||||
|
|
||||||
|
module Admin
|
||||||
|
class ProductsController < ResourcesController; end
|
||||||
|
class ImagesController < ResourcesController; end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class ResourcesTest < ActionController::TestCase
|
||||||
def test_default_restful_routes
|
def test_default_restful_routes
|
||||||
with_restful_routing :messages do
|
with_restful_routing :messages do
|
||||||
assert_simply_restful_for :messages
|
assert_simply_restful_for :messages
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
require 'abstract_unit'
|
require 'abstract_unit'
|
||||||
|
|
||||||
|
class ReviewsController < ResourcesController; end
|
||||||
|
|
||||||
class RoutingConcernsTest < ActionDispatch::IntegrationTest
|
class RoutingConcernsTest < ActionDispatch::IntegrationTest
|
||||||
class Reviewable
|
class Reviewable
|
||||||
def self.call(mapper, options = {})
|
def self.call(mapper, options = {})
|
||||||
|
|
Loading…
Reference in a new issue