repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/url_for_test.rb | actionpack/test/controller/url_for_test.rb | # frozen_string_literal: true
require "abstract_unit"
module AbstractController
module Testing
class UrlForTest < ActionController::TestCase
class W
include ActionDispatch::Routing::RouteSet.new.tap { |r|
r.draw {
ActionDispatch.deprecator.silence {
get ":contro... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/log_subscriber_test.rb | actionpack/test/controller/log_subscriber_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/log_subscriber/test_helper"
require "action_controller/log_subscriber"
class ACLogSubscriberTest < ActionController::TestCase
module Another
class LogSubscribersController < ActionController::Base
wrap_parameters :person, includ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/url_for_integration_test.rb | actionpack/test/controller/url_for_integration_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_controllers"
require "active_support/core_ext/object/with_options"
module ActionPack
class URLForIntegrationTest < ActiveSupport::TestCase
include RoutingTestHelpers
include ActionDispatch::RoutingVerbs
Model = Struct.new(:t... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/renderers_test.rb | actionpack/test/controller/renderers_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_models"
require "active_support/logger"
class RenderersTest < ActionController::TestCase
class XmlRenderable
def to_xml(options)
options[:root] ||= "i-am-xml"
"<#{options[:root]}/>"
end
end
class JsonRenderable
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/flash_hash_test.rb | actionpack/test/controller/flash_hash_test.rb | # frozen_string_literal: true
require "abstract_unit"
module ActionDispatch
class FlashHashTest < ActiveSupport::TestCase
def setup
@hash = Flash::FlashHash.new
end
def test_set_get
@hash[:foo] = "zomg"
assert_equal "zomg", @hash[:foo]
end
def test_keys
assert_equal [],... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/action_pack_assertions_test.rb | actionpack/test/controller/action_pack_assertions_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_controllers"
class ActionPackAssertionsController < ActionController::Base
def nothing() head :ok end
def hello_xml_world() render template: "test/hello_xml_world"; end
def hello_xml_world_pdf
self.content_type = "application/p... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/render_to_string_test.rb | actionpack/test/controller/render_to_string_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_models"
require "active_support/logger"
class RenderToStringTest < ActionController::TestCase
class TestController < ActionController::Base
protect_from_forgery
def self.controller_path
"test"
end
def render_plain... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters_integration_test.rb | actionpack/test/controller/parameters_integration_test.rb | # frozen_string_literal: true
require "abstract_unit"
class IntegrationController < ActionController::Base
def yaml_params
render plain: params.to_yaml
end
def permit_params
params.permit(
key1: {}
)
render plain: "Home"
end
end
class ActionControllerParametersIntegrationTest < Action... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/redirect_test.rb | actionpack/test/controller/redirect_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/log_subscriber/test_helper"
class Workshop
extend ActiveModel::Naming
include ActiveModel::Conversion
OUT_OF_SCOPE_BLOCK = proc do
raise "Not executed in controller's context" unless RedirectController === self
request.origin... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/rescue_test.rb | actionpack/test/controller/rescue_test.rb | # frozen_string_literal: true
require "abstract_unit"
class RescueController < ActionController::Base
class NotAuthorized < StandardError
end
class NotAuthorizedToRescueAsString < StandardError
end
class RecordInvalid < StandardError
end
class RecordInvalidToRescueAsString < StandardError
end
clas... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/caching_test.rb | actionpack/test/controller/caching_test.rb | # frozen_string_literal: true
require "fileutils"
require "abstract_unit"
require "lib/controller/fake_models"
CACHE_DIR = "test_cache"
# Don't change '/../temp/' cavalierly or you might hose something you don't want hosed
FILE_STORE_PATH = File.join(__dir__, "../temp/", CACHE_DIR)
class FragmentCachingMetalTestCont... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/webservice_test.rb | actionpack/test/controller/webservice_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/json/decoding"
class WebServiceTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
def assign_parameters
if params[:full]
render plain: dump_params_keys
else
render plain: (... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/default_url_options_with_before_action_test.rb | actionpack/test/controller/default_url_options_with_before_action_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ControllerWithBeforeActionAndDefaultUrlOptions < ActionController::Base
before_action { I18n.locale = params[:locale] }
after_action { I18n.locale = "en" }
def target
render plain: "final response"
end
def redirect
redirect_to action: "ta... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/conditional_get_directives_test.rb | actionpack/test/controller/conditional_get_directives_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ConditionalGetDirectivesController < ActionController::Base
def must_understand_action
must_understand
render plain: "using must-understand directive"
end
def cache_control_with_must_understand
fresh_when etag: "123", cache_control: { must... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/permitted_params_test.rb | actionpack/test/controller/permitted_params_test.rb | # frozen_string_literal: true
require "abstract_unit"
class PeopleController < ActionController::Base
def create
render plain: params[:person].permitted? ? "permitted" : "forbidden"
end
def create_with_permit
render plain: params[:person].permit(:name).permitted? ? "permitted" : "forbidden"
end
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/logging_test.rb | actionpack/test/controller/logging_test.rb | # frozen_string_literal: true
require "abstract_unit"
class LoggingTest < ActionController::TestCase
class TestController < ActionController::Base
log_at :debug, if: -> { params[:level] == "debug" }
log_at :warn, if: -> { params[:level] == "warn" }
def show
render plain: logger.level
end
e... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/required_params_test.rb | actionpack/test/controller/required_params_test.rb | # frozen_string_literal: true
require "abstract_unit"
class BooksController < ActionController::Base
def create
params.require(:book).require(:name)
head :ok
end
end
class ActionControllerRequiredParamsTest < ActionController::TestCase
tests BooksController
test "missing required parameters will rai... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/params_wrapper_test.rb | actionpack/test/controller/params_wrapper_test.rb | # frozen_string_literal: true
require "abstract_unit"
module Admin; class User; end; end
module ParamsWrapperTestHelp
def with_default_wrapper_options(&block)
@controller.class._set_wrapper_options(format: [:json])
@controller.class.inherited(@controller.class)
yield
end
def assert_parameters(expe... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/render_json_test.rb | actionpack/test/controller/render_json_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_models"
require "active_support/logger"
require "active_support/core_ext/object/with"
class RenderJsonTest < ActionController::TestCase
class JsonRenderable
def as_json(options = {})
hash = { a: :b, c: :d, e: :f }
hash.ex... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/flash_test.rb | actionpack/test/controller/flash_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/messages/rotation_configuration"
class FlashTest < ActionController::TestCase
class TestController < ActionController::Base
def set_flash
flash["that"] = "hello"
render inline: "hello"
end
def set_flash_now
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/resources_test.rb | actionpack/test/controller/resources_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/core_ext/object/with_options"
class AdminController < ResourcesController; end
class MessagesController < ResourcesController; end
class ProductsController < ResourcesController; end
class ThreadsController < ResourcesController; end
modul... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/request_forgery_protection_test.rb | actionpack/test/controller/request_forgery_protection_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/log_subscriber/test_helper"
require "active_support/messages/rotation_configuration"
# common controller actions
module RequestForgeryProtectionActions
def index
render inline: "<%= form_tag('/') {} %>"
end
def show_button
re... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/streaming_test.rb | actionpack/test/controller/streaming_test.rb | # frozen_string_literal: true
require "abstract_unit"
module ActionController
class StreamingResponseTest < ActionController::TestCase
class TestController < ActionController::Base
def self.controller_path
"test"
end
def basic_stream
%w{ hello world }.each do |word|
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/http_digest_authentication_test.rb | actionpack/test/controller/http_digest_authentication_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/key_generator"
class HttpDigestAuthenticationTest < ActionController::TestCase
class DummyDigestController < ActionController::Base
before_action :authenticate, only: :index
before_action :authenticate_with_request, only: :display... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/http_token_authentication_test.rb | actionpack/test/controller/http_token_authentication_test.rb | # frozen_string_literal: true
require "abstract_unit"
class HttpTokenAuthenticationTest < ActionController::TestCase
class DummyController < ActionController::Base
before_action :authenticate, only: :index
before_action :authenticate_with_request, only: :display
before_action :authenticate_long_credenti... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/routing_test.rb | actionpack/test/controller/routing_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_controllers"
require "active_support/core_ext/object/with_options"
require "active_support/core_ext/object/json"
class MilestonesController < ActionController::Base
def index() head :ok end
alias_method :show, :index
end
# See RFC 398... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/filters_test.rb | actionpack/test/controller/filters_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ActionController::Base
class << self
%w(append_around_action prepend_after_action prepend_around_action prepend_before_action skip_after_action skip_before_action).each do |pending|
define_method(pending) do |*args|
$stderr.puts "#{pendin... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/test_case_test.rb | actionpack/test/controller/test_case_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_controllers"
require "active_support/json/decoding"
require "rails/engine"
class TestCaseTest < ActionController::TestCase
def self.fixture_paths
[]
end
self.file_fixture_path = File.expand_path("../fixtures/multipart", __dir__)... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/helper_test.rb | actionpack/test/controller/helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
ActionController::Base.helpers_path = File.expand_path("../fixtures/helpers", __dir__)
module Fun
class GamesController < ActionController::Base
def render_hello_world
render inline: "hello: <%= stratego %>"
end
end
class PdfController < Acti... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/render_test.rb | actionpack/test/controller/render_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_models"
require "support/etag_helper"
class TestControllerWithExtraEtags < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new(
"test/with_implicit_template.erb" => "Hello explicitly!",
"test/hello_world.erb... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/show_exceptions_test.rb | actionpack/test/controller/show_exceptions_test.rb | # frozen_string_literal: true
require "abstract_unit"
module ShowExceptions
class ShowExceptionsController < ActionController::Base
use ActionDispatch::ShowExceptions, ActionDispatch::PublicExceptions.new("#{FIXTURE_LOAD_PATH}/public")
use ActionDispatch::DebugExceptions
before_action only: :another_bo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/sse_perform_write_test.rb | actionpack/test/controller/sse_perform_write_test.rb | # frozen_string_literal: true
require "abstract_unit"
module ActionController
# Unit tests for ActionController::Live::SSE focusing on underlying write semantics.
# These tests ensure that each call to SSE#write results in exactly one call to the
# underlying stream#write, even when multiple options (event, ret... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/form_builder_test.rb | actionpack/test/controller/form_builder_test.rb | # frozen_string_literal: true
require "abstract_unit"
class FormBuilderController < ActionController::Base
class SpecializedFormBuilder < ActionView::Helpers::FormBuilder ; end
default_form_builder SpecializedFormBuilder
end
class ControllerFormBuilderTest < ActiveSupport::TestCase
setup do
@controller = ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/content_type_test.rb | actionpack/test/controller/content_type_test.rb | # frozen_string_literal: true
require "abstract_unit"
class OldContentTypeController < ActionController::Base
# :ported:
def render_content_type_from_body
response.content_type = Mime[:rss]
render body: "hello world!"
end
# :ported:
def render_defaults
render body: "hello world!"
end
# :po... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/metal_test.rb | actionpack/test/controller/metal_test.rb | # frozen_string_literal: true
require "abstract_unit"
class MetalControllerInstanceTests < ActiveSupport::TestCase
class SimpleController < ActionController::Metal
def hello
self.response_body = "hello"
end
end
def test_response_does_not_have_default_headers
original_default_headers = ActionD... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/live_stream_test.rb | actionpack/test/controller/live_stream_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "timeout"
require "concurrent/atomic/count_down_latch"
require "zeitwerk"
Thread.abort_on_exception = true
module ActionController
class SSETest < ActionController::TestCase
class SSETestController < ActionController::Base
include ActionContro... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/output_escaping_test.rb | actionpack/test/controller/output_escaping_test.rb | # frozen_string_literal: true
require "abstract_unit"
class OutputEscapingTest < ActiveSupport::TestCase
test "escape_html shouldn't die when passed nil" do
assert_predicate ERB::Util.h(nil), :blank?
end
test "escapeHTML should escape strings" do
assert_equal "<>"", ERB::Util.h("<>\"")
end... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameter_encoding_test.rb | actionpack/test/controller/parameter_encoding_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ParameterEncodingController < ActionController::Base
def test_undeclared_parameter
render body: params[:foo].encoding
end
skip_parameter_encoding :test_skip_parameter_encoding
def test_skip_parameter_encoding
render body: params[:bar].encodi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/chunked_test.rb | actionpack/test/controller/chunked_test.rb | # frozen_string_literal: true
require "stringio"
require "abstract_unit"
class ChunkedTest < ActionDispatch::IntegrationTest
class ChunkedController < ApplicationController
def chunk
render json: {
raw_post: request.raw_post,
content_length: request.content_length
}
end
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/render_xml_test.rb | actionpack/test/controller/render_xml_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_models"
class RenderXmlTest < ActionController::TestCase
class XmlRenderable
def to_xml(options)
options[:root] ||= "i-am-xml"
"<#{options[:root]}/>"
end
end
class TestController < ActionController::Base
prot... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/runner_test.rb | actionpack/test/controller/runner_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_dispatch/testing/integration"
module ActionDispatch
class RunnerTest < ActiveSupport::TestCase
class MyRunner
include Integration::Runner
def initialize(session)
@integration_session = session
end
def hi; end... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/params_parse_test.rb | actionpack/test/controller/params_parse_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ParamsParseTest < ActionController::TestCase
class UsersController < ActionController::Base
def create
head :ok
end
end
tests UsersController
def test_parse_error_logged_once
log_output = capture_log_output do
post :create, ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/rate_limiting_test.rb | actionpack/test/controller/rate_limiting_test.rb | # frozen_string_literal: true
require "abstract_unit"
class RateLimitedController < ActionController::Base
self.cache_store = ActiveSupport::Cache::MemoryStore.new
rate_limit to: 2, within: 2.seconds, only: :limited
rate_limit to: 5, within: 1.minute, name: "long-term", only: :limited
def limited
head :o... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/base_test.rb | actionpack/test/controller/base_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/logger"
require "controller/fake_models"
# Provide some controller to run the tests on.
module Submodule
class ContainedEmptyController < ActionController::Base
end
end
class EmptyController < ActionController::Base
end
class SimpleCo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/route_helpers_test.rb | actionpack/test/controller/route_helpers_test.rb | # frozen_string_literal: true
require "abstract_unit"
class RouteHelperIntegrationTest < ActionDispatch::IntegrationTest
class FooController < ApplicationController
end
# We define many routes in these modules after they have been included into
# the controllers. For boot performance, it's important that we ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/localized_templates_test.rb | actionpack/test/controller/localized_templates_test.rb | # frozen_string_literal: true
require "abstract_unit"
class LocalizedController < ActionController::Base
def hello_world
end
end
class LocalizedTemplatesTest < ActionController::TestCase
tests LocalizedController
setup do
@old_locale = I18n.locale
end
teardown do
I18n.locale = @old_locale
end... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/allow_browser_test.rb | actionpack/test/controller/allow_browser_test.rb | # frozen_string_literal: true
require "abstract_unit"
class AllowBrowserController < ActionController::Base
allow_browser versions: { safari: "16.4", chrome: "119", firefox: "123", opera: "106", ie: false }, block: -> { head :upgrade_required }, only: :hello
def hello
head :ok
end
allow_browser versions:... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_action_test.rb | actionpack/test/controller/new_base/render_action_test.rb | # frozen_string_literal: true
require "abstract_unit"
module RenderAction
# This has no layout and it works
class BasicController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new(
"render_action/basic/hello_world.html.erb" => "Hello world!"
)]
def hello_world
re... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_body_test.rb | actionpack/test/controller/new_base/render_body_test.rb | # frozen_string_literal: true
require "abstract_unit"
module RenderBody
class MinimalController < ActionController::Metal
include AbstractController::Rendering
include ActionController::Rendering
def index
render body: "Hello World!"
end
end
class SimpleController < ActionController::Bas... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/middleware_test.rb | actionpack/test/controller/new_base/middleware_test.rb | # frozen_string_literal: true
require "abstract_unit"
module MiddlewareTest
class MyMiddleware
def initialize(app, kw: nil)
@app = app
end
def call(env)
result = @app.call(env)
result[1]["Middleware-Test"] = "Success"
result[1]["Middleware-Order"] = "First"
result
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/bare_metal_test.rb | actionpack/test/controller/new_base/bare_metal_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/core_ext/array/access"
module BareMetalTest
class BareController < ActionController::Metal
def index
self.response_body = "Hello world"
end
def assign_response_array
self.response = [200, { "content-type" => "text... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_html_test.rb | actionpack/test/controller/new_base/render_html_test.rb | # frozen_string_literal: true
require "abstract_unit"
module RenderHtml
class MinimalController < ActionController::Metal
include AbstractController::Rendering
include ActionController::Rendering
def index
render html: "Hello World!"
end
end
class SimpleController < ActionController::Bas... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_streaming_test.rb | actionpack/test/controller/new_base/render_streaming_test.rb | # frozen_string_literal: true
require "abstract_unit"
module RenderStreaming
class BasicController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new(
"render_streaming/basic/hello_world.html.erb" => "Hello world",
"render_streaming/basic/boom.html.erb" => "<%= raise 'Ruby w... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_test.rb | actionpack/test/controller/new_base/render_test.rb | # frozen_string_literal: true
require "abstract_unit"
module Render
class BlankRenderController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new(
"render/blank_render/index.html.erb" => "Hello world!",
"render/blank_render/access_request.html.erb" ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/content_type_test.rb | actionpack/test/controller/new_base/content_type_test.rb | # frozen_string_literal: true
require "abstract_unit"
module ContentType
class BaseController < ActionController::Base
def index
render body: "Hello world!"
end
def set_on_response_obj
response.content_type = Mime[:rss]
render body: "Hello world!"
end
def set_on_render
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_implicit_action_test.rb | actionpack/test/controller/new_base/render_implicit_action_test.rb | # frozen_string_literal: true
require "abstract_unit"
module RenderImplicitAction
class SimpleController < ::ApplicationController
self.view_paths = [ActionView::FixtureResolver.new(
"render_implicit_action/simple/hello_world.html.erb" => "Hello world!",
"render_implicit_action/simple/hyphen-ate... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_file_test.rb | actionpack/test/controller/new_base/render_file_test.rb | # frozen_string_literal: true
require "abstract_unit"
module RenderFile
class BasicController < ActionController::Base
self.view_paths = __dir__
def index
render file: File.expand_path("../../fixtures/test/hello_world.erb", __dir__)
end
def pathname
render file: Pathname.new(__dir__).j... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/content_negotiation_test.rb | actionpack/test/controller/new_base/content_negotiation_test.rb | # frozen_string_literal: true
require "abstract_unit"
module ContentNegotiation
# This has no layout and it works
class BasicController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new(
"content_negotiation/basic/hello.html.erb" => "Hello world <%= request.formats.first.to_s %... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_xml_test.rb | actionpack/test/controller/new_base/render_xml_test.rb | # frozen_string_literal: true
require "abstract_unit"
module RenderXml
# This has no layout and it works
class BasicController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new(
"render_xml/basic/with_render_erb" => "Hello world!"
)]
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_plain_test.rb | actionpack/test/controller/new_base/render_plain_test.rb | # frozen_string_literal: true
require "abstract_unit"
module RenderPlain
class MinimalController < ActionController::Metal
include AbstractController::Rendering
include ActionController::Rendering
def index
render plain: "Hello World!"
end
end
class SimpleController < ActionController::B... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/base_test.rb | actionpack/test/controller/new_base/base_test.rb | # frozen_string_literal: true
require "abstract_unit"
# Tests the controller dispatching happy path
module Dispatching
class SimpleController < ActionController::Base
before_action :authenticate
def index
render body: "success"
end
def modify_response_body
self.response_body = "success... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_partial_test.rb | actionpack/test/controller/new_base/render_partial_test.rb | # frozen_string_literal: true
require "abstract_unit"
module RenderPartial
class BasicController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new(
"render_partial/basic/_basic.html.erb" => "BasicPartial!",
"render_partial/basic/basic.html.erb" => "<%= @test_unch... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_template_test.rb | actionpack/test/controller/new_base/render_template_test.rb | # frozen_string_literal: true
require "abstract_unit"
module RenderTemplate
class WithoutLayoutController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new(
"test/basic.html.erb" => "Hello from basic.html.erb",
"shared.html.erb" => "Elastica",
"local... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/new_base/render_layout_test.rb | actionpack/test/controller/new_base/render_layout_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "test_renderable"
module ControllerLayouts
class ImplicitController < ::ApplicationController
self.view_paths = [ActionView::FixtureResolver.new(
"layouts/application.html.erb" => "Main <%= yield %> Layout",
"layouts/override.html.erb" ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb | actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false | |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb | actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false | |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb | actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false | |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/api/url_for_test.rb | actionpack/test/controller/api/url_for_test.rb | # frozen_string_literal: true
require "abstract_unit"
class UrlForApiController < ActionController::API
def one; end
def two; end
end
class UrlForApiTest < ActionController::TestCase
tests UrlForApiController
def setup
super
@request.host = "www.example.com"
end
def test_url_for
get :one
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/api/renderers_test.rb | actionpack/test/controller/api/renderers_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/core_ext/hash/conversions"
class RenderersApiController < ActionController::API
class Model
def to_json(options = {})
{ a: "b" }.to_json(options)
end
def to_xml(options = {})
{ a: "b" }.to_xml(options)
end
e... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/api/params_wrapper_test.rb | actionpack/test/controller/api/params_wrapper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ParamsWrapperForApiTest < ActionController::TestCase
class UsersController < ActionController::API
attr_accessor :last_parameters
wrap_parameters :person, format: [:json]
def test
self.last_parameters = params.except(:controller, :actio... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/api/implicit_render_test.rb | actionpack/test/controller/api/implicit_render_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ImplicitRenderAPITestController < ActionController::API
def empty_action
end
def returning_mock
require "minitest/mock"
Minitest::Mock.new
end
end
class ImplicitRenderAPITest < ActionController::TestCase
tests ImplicitRenderAPITestControl... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/api/redirect_to_test.rb | actionpack/test/controller/api/redirect_to_test.rb | # frozen_string_literal: true
require "abstract_unit"
class RedirectToApiController < ActionController::API
def one
redirect_to action: "two"
end
def two; end
end
class RedirectToApiTest < ActionController::TestCase
tests RedirectToApiController
def test_redirect_to
get :one
assert_response :... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/api/data_streaming_test.rb | actionpack/test/controller/api/data_streaming_test.rb | # frozen_string_literal: true
require "abstract_unit"
module TestApiFileUtils
def file_path() __FILE__ end
def file_data() @data ||= File.binread(file_path) end
end
class DataStreamingApiController < ActionController::API
include TestApiFileUtils
def one; end
def two
send_data(file_data, {})
end
end... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/api/conditional_get_test.rb | actionpack/test/controller/api/conditional_get_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/core_ext/integer/time"
require "active_support/core_ext/numeric/time"
require "support/etag_helper"
class ConditionalGetApiController < ActionController::API
before_action :handle_last_modified_and_etags, only: :two
def one
if stal... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/api/with_cookies_test.rb | actionpack/test/controller/api/with_cookies_test.rb | # frozen_string_literal: true
require "abstract_unit"
class WithCookiesController < ActionController::API
include ActionController::Cookies
def with_cookies
render plain: cookies[:foobar]
end
end
class WithCookiesTest < ActionController::TestCase
tests WithCookiesController
def test_with_cookies
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/api/rate_limiting_test.rb | actionpack/test/controller/api/rate_limiting_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ApiRateLimitedController < ActionController::API
self.cache_store = ActiveSupport::Cache::MemoryStore.new
rate_limit to: 2, within: 2.seconds, only: :limited_to_two
def limited_to_two
head :ok
end
end
class ApiRateLimitingTest < ActionControlle... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/api/with_helpers_test.rb | actionpack/test/controller/api/with_helpers_test.rb | # frozen_string_literal: true
require "abstract_unit"
module ApiWithHelper
def my_helper
"helper"
end
end
class WithHelpersController < ActionController::API
include ActionController::Helpers
helper ApiWithHelper
def with_helpers
render plain: self.class.helpers.my_helper
end
end
class Subclass... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/metal/renderers_test.rb | actionpack/test/controller/metal/renderers_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/core_ext/hash/conversions"
class MetalRenderingController < ActionController::Metal
include AbstractController::Rendering
include ActionController::Rendering
include ActionController::Renderers
end
class MetalRenderingJsonController ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/mime/accept_format_test.rb | actionpack/test/controller/mime/accept_format_test.rb | # frozen_string_literal: true
require "abstract_unit"
class StarStarMimeController < ActionController::Base
layout nil
def index
render
end
end
class StarStarMimeControllerTest < ActionController::TestCase
def test_javascript_with_format
@request.accept = "text/javascript"
get :index, format: "j... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/mime/respond_to_test.rb | actionpack/test/controller/mime/respond_to_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/log_subscriber/test_helper"
class RespondToController < ActionController::Base
layout :set_layout
before_action {
case params[:v]
when String then request.variant = params[:v].to_sym
when Array then request.variant = params... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/nested_parameters_permit_test.rb | actionpack/test/controller/parameters/nested_parameters_permit_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller/metal/strong_parameters"
class NestedParametersPermitTest < ActiveSupport::TestCase
def assert_filtered_out(params, key)
assert_not params.has_key?(key), "key #{key.inspect} has not been filtered out"
end
test "permitted neste... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/equality_test.rb | actionpack/test/controller/parameters/equality_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller/metal/strong_parameters"
class ParametersAccessorsTest < ActiveSupport::TestCase
setup do
ActionController::Parameters.permit_all_parameters = false
@params = ActionController::Parameters.new(
person: {
age: "32"... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/parameters_expect_test.rb | actionpack/test/controller/parameters/parameters_expect_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_dispatch/http/upload"
require "action_controller/metal/strong_parameters"
class ParametersExpectTest < ActiveSupport::TestCase
setup do
@params = ActionController::Parameters.new(
person: {
age: "32",
name: {
f... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/serialization_test.rb | actionpack/test/controller/parameters/serialization_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller/metal/strong_parameters"
class ParametersSerializationTest < ActiveSupport::TestCase
setup do
@old_permitted_parameters = ActionController::Parameters.permit_all_parameters
ActionController::Parameters.permit_all_parameters = f... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb | actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/testing/event_reporter_assertions"
require "action_controller/metal/strong_parameters"
class LogOnUnpermittedParamsTest < ActiveSupport::TestCase
include ActiveSupport::Testing::EventReporterAssertions
def setup
ActionController::P... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/mutators_test.rb | actionpack/test/controller/parameters/mutators_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller/metal/strong_parameters"
class ParametersMutatorsTest < ActiveSupport::TestCase
setup do
@params = ActionController::Parameters.new(
person: {
age: "32",
name: {
first: "David",
last: "Hein... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb | actionpack/test/controller/parameters/multi_parameter_attributes_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller/metal/strong_parameters"
class MultiParameterAttributesTest < ActiveSupport::TestCase
test "permitted multi-parameter attribute keys" do
params = ActionController::Parameters.new(
book: {
"shipped_at(1i)" => "2012",... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/accessors_test.rb | actionpack/test/controller/parameters/accessors_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller/metal/strong_parameters"
class ParametersAccessorsTest < ActiveSupport::TestCase
setup do
ActionController::Parameters.permit_all_parameters = false
@params = ActionController::Parameters.new(
person: {
age: "32"... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb | actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller/metal/strong_parameters"
class RaiseOnUnpermittedParamsTest < ActiveSupport::TestCase
def setup
ActionController::Parameters.action_on_unpermitted_parameters = :raise
end
def teardown
ActionController::Parameters.action_on... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/dup_test.rb | actionpack/test/controller/parameters/dup_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller/metal/strong_parameters"
require "active_support/core_ext/object/deep_dup"
class ParametersDupTest < ActiveSupport::TestCase
setup do
ActionController::Parameters.permit_all_parameters = false
@params = ActionController::Param... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/always_permitted_parameters_test.rb | actionpack/test/controller/parameters/always_permitted_parameters_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller/metal/strong_parameters"
class AlwaysPermittedParametersTest < ActiveSupport::TestCase
def setup
ActionController::Parameters.action_on_unpermitted_parameters = :raise
ActionController::Parameters.always_permitted_parameters = ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/parameters/parameters_permit_test.rb | actionpack/test/controller/parameters/parameters_permit_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_dispatch/http/upload"
require "action_controller/metal/strong_parameters"
class ParametersPermitTest < ActiveSupport::TestCase
def assert_filtered_out(params, key)
assert_not params.has_key?(key), "key #{key.inspect} has not been filtered out... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/controller/request/test_request_test.rb | actionpack/test/controller/request/test_request_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "stringio"
class ActionController::TestRequestTest < ActionController::TestCase
def test_test_request_has_session_options_initialized
assert @request.session_options
end
def test_mutating_session_options_does_not_affect_default_options
@requ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/abstract/collector_test.rb | actionpack/test/abstract/collector_test.rb | # frozen_string_literal: true
require "abstract_unit"
module AbstractController
module Testing
class MyCollector
include AbstractController::Collector
attr_accessor :responses
def initialize
@responses = []
end
def custom(mime, *args, **kwargs, &block)
@responses ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/abstract/translation_test.rb | actionpack/test/abstract/translation_test.rb | # frozen_string_literal: true
require "abstract_unit"
module AbstractController
module Testing
class TranslationController < AbstractController::Base
include AbstractController::Translation
end
class TranslationControllerTest < ActiveSupport::TestCase
def setup
@controller = Transla... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/abstract/callbacks_test.rb | actionpack/test/abstract/callbacks_test.rb | # frozen_string_literal: true
require "abstract_unit"
module AbstractController
module Testing
class ControllerWithCallbacks < AbstractController::Base
include AbstractController::Callbacks
end
class Callback1 < ControllerWithCallbacks
set_callback :process_action, :before, :first
de... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/support/path_helper.rb | actionpack/test/support/path_helper.rb | # frozen_string_literal: true
module ActionDispatch
module Journey
module PathHelper
def path_from_string(string)
build_path(string, {}, "/.?", true)
end
def build_path(path, requirements, separators, anchored, formatted = true)
parser = ActionDispatch::Journey::Parser.new
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/support/rack_parsing_override.rb | actionpack/test/support/rack_parsing_override.rb | # frozen_string_literal: true
# Because we implement our own query string parsing, and it is extremely
# similar to Rack's in most simple cases, it would be very easy to have
# locations sneak in where we unknowingly depend on Rack's
# interpretation rather than our own, potentially creating edge-case
# incompatibilit... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/support/system_helper.rb | actionpack/test/support/system_helper.rb | # frozen_string_literal: true
class DrivenByRackTest < ActionDispatch::SystemTestCase
driven_by :rack_test
end
class DrivenBySeleniumWithChrome < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome
end
class DrivenBySeleniumWithHeadlessChrome < ActionDispatch::SystemTestCase
driven_by :selenium,... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/test/support/etag_helper.rb | actionpack/test/support/etag_helper.rb | # frozen_string_literal: true
module EtagHelper
def weak_etag(record)
"W/#{strong_etag record}"
end
def strong_etag(record)
%("#{ActiveSupport::Digest.hexdigest(ActiveSupport::Cache.expand_cache_key(record))}")
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.