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/actionview/test/fixtures/helpers/abc_helper.rb | actionview/test/fixtures/helpers/abc_helper.rb | # frozen_string_literal: true
module AbcHelper
def bare_a() end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/lib/test_renderable.rb | actionview/test/lib/test_renderable.rb | # frozen_string_literal: true
class TestRenderable
def render_in(_view_context)
"Hello, World!"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/lib/controller/fake_models.rb | actionview/test/lib/controller/fake_models.rb | # frozen_string_literal: true
require "active_model"
Customer = Struct.new(:name, :id) do
extend ActiveModel::Naming
include ActiveModel::Conversion
undef_method :to_json
def to_xml(options = {})
if options[:builder]
options[:builder].name name
else
"<name>#{name}</name>"
end
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/compiled_templates_test.rb | actionview/test/template/compiled_templates_test.rb | # frozen_string_literal: true
require "abstract_unit"
class CompiledTemplatesTest < ActiveSupport::TestCase
attr_reader :view_class
def setup
super
view_paths = ActionController::Base.view_paths
view_paths.each(&:clear_cache)
@view_class = ActionView::Base.with_empty_template_cache
end
def t... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/structured_event_subscriber_test.rb | actionview/test/template/structured_event_subscriber_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/testing/event_reporter_assertions"
require "action_view/structured_event_subscriber"
require "controller/fake_models"
module ActionView
class StructuredEventSubscriberTest < ActiveSupport::TestCase
include ActiveSupport::Testing::Even... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/template_path_test.rb | actionview/test/template/template_path_test.rb | # frozen_string_literal: true
require "abstract_unit"
class TemplatePathTest < ActiveSupport::TestCase
def test_build_returns_path_object
path = ActionView::TemplatePath.build("bar", "foo", true)
assert_equal "foo/_bar", path.virtual
assert_equal "foo", path.prefix
assert_equal "bar", path.name
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/sanitize_helper_test.rb | actionview/test/template/sanitize_helper_test.rb | # frozen_string_literal: true
#
# This file has two suites of tests:
# - A unit test suite for SanitizeHelper behavior
# - An integration test suite to verify basic expectations for each supported sanitizer vendor
#
require "abstract_unit"
#
# Unit test SanitizeHelper behavior. We use a mock vendor to ensure we'... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/template_test.rb | actionview/test/template/template_test.rb | # encoding: US-ASCII
# frozen_string_literal: true
require "abstract_unit"
class TestERBTemplate < ActiveSupport::TestCase
ERBHandler = ActionView::Template::Handlers::ERB.new
class LookupContext
def disable_cache
yield
end
def find_template(*args)
end
attr_accessor :formats
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/log_subscriber_test.rb | actionview/test/template/log_subscriber_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/log_subscriber/test_helper"
require "action_view/log_subscriber"
require "controller/fake_models"
require "active_support/testing/event_reporter_assertions"
class AVLogSubscriberTest < ActiveSupport::TestCase
include ActiveSupport::Testin... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/template_error_test.rb | actionview/test/template/template_error_test.rb | # frozen_string_literal: true
require "abstract_unit"
class TemplateErrorTest < ActiveSupport::TestCase
def test_provides_original_message
error = begin
raise Exception.new("original")
rescue Exception
raise ActionView::Template::Error.new("test") rescue $!
end
assert_equal "original", ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/dependency_tracker_test.rb | actionview/test/template/dependency_tracker_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_view/dependency_tracker"
require "action_view/render_parser/prism_render_parser"
require "ripper"
require "action_view/render_parser/ripper_render_parser"
class NeckbeardTracker
def self.call(name, template)
["foo/#{name}"]
end
end
class... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/number_helper_test.rb | actionview/test/template/number_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class NumberHelperTest < ActionView::TestCase
tests ActionView::Helpers::NumberHelper
def test_number_to_phone
assert_nil number_to_phone(nil)
assert_equal "555-1234", number_to_phone(5551234)
assert_equal "(800) 555-1212 x 123", number_to_phone(8... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/form_collections_helper_test.rb | actionview/test/template/form_collections_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
Category = Struct.new(:id, :name)
class FormCollectionsHelperTest < ActionView::TestCase
def assert_no_select(selector, value = nil)
assert_select(selector, text: value, count: 0)
end
def with_collection_radio_buttons(*args, &block)
@rendered = col... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/translation_helper_test.rb | actionview/test/template/translation_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
module I18n
class CustomExceptionHandler
def self.call(exception, locale, key, options)
"from CustomExceptionHandler"
end
end
end
class TranslationHelperTest < ActiveSupport::TestCase
include ActionView::Helpers::TranslationHelper
attr_read... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/csp_helper_test.rb | actionview/test/template/csp_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class CspHelperWithCspEnabledTest < ActionView::TestCase
tests ActionView::Helpers::CspHelper
def content_security_policy_nonce
"iyhD0Yc0W+c="
end
def content_security_policy?
true
end
def test_csp_meta_tag
assert_equal "<meta name=\"csp... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/form_options_helper_test.rb | actionview/test/template/form_options_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/core_ext/enumerable"
require "active_support/core_ext/object/with"
class Map < Hash
def category
"<mus>"
end
end
class CustomEnumerable
include Enumerable
def each
yield "one"
yield "two"
end
end
class FormOptionsHe... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/partial_iteration_test.rb | actionview/test/template/partial_iteration_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_view/renderer/collection_renderer"
class PartialIterationTest < ActiveSupport::TestCase
def test_has_size_and_index
iteration = ActionView::PartialIteration.new 3
assert_equal 0, iteration.index, "should be at the first index"
assert_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/tag_helper_test.rb | actionview/test/template/tag_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class TagHelperTest < ActionView::TestCase
include RenderERBUtils
tests ActionView::Helpers::TagHelper
COMMON_DANGEROUS_CHARS = "&<>\"' %*+,/;=^|"
INVALID_TAG_CHARS = "> /"
def test_tag
assert_equal "<br />", tag("br")
assert_equal "<br clear=... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/lookup_context_test.rb | actionview/test/template/lookup_context_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "abstract_controller/rendering"
class LookupContextTest < ActiveSupport::TestCase
def setup
@lookup_context = build_lookup_context(FIXTURE_LOAD_PATH, {})
ActionView::LookupContext::DetailsKey.clear
end
def build_lookup_context(paths, details... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/record_identifier_test.rb | actionview/test/template/record_identifier_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_models"
class RecordIdentifierTest < ActiveSupport::TestCase
include ActionView::RecordIdentifier
def setup
@klass = Comment
@record = @klass.new
@singular = "comment"
@plural = "comments"
end
def test_dom_id_wit... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/streaming_render_test.rb | actionview/test/template/streaming_render_test.rb | # frozen_string_literal: true
require "abstract_unit"
class TestController < ActionController::Base
end
class SetupFiberedBase < ActiveSupport::TestCase
def setup
ActionView::LookupContext::DetailsKey.clear
view_paths = ActionController::Base.view_paths
@assigns = { secret: "in the sauce", name: nil ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/url_helper_test.rb | actionview/test/template/url_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class Workshop
extend ActiveModel::Naming
include ActiveModel::Conversion
attr_accessor :id
def initialize(id)
@id = id
end
def persisted?
id.present?
end
def to_s
"Workshop #{id}"
end
end
class UrlHelperTest < ActiveSupport::Test... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/test_test.rb | actionview/test/template/test_test.rb | # frozen_string_literal: true
require "abstract_unit"
module PeopleHelper
def title(text)
content_tag(:h1, text)
end
def homepage_path
people_path
end
def homepage_url
people_url
end
def link_to_person(person)
link_to person.name, person
end
end
class PeopleHelperTest < ActionView:... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/digestor_test.rb | actionview/test/template/digestor_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "fileutils"
require "action_view/dependency_tracker"
class FixtureFinder < ActionView::LookupContext
FIXTURES_DIR = File.expand_path("../fixtures/digestor", __dir__)
def self.build(details = {})
new(ActionView::PathSet.new(["digestor", "digestor/a... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/form_helper_test.rb | actionview/test/template/form_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_models"
require "active_support/core_ext/object/with"
class FormHelperTest < ActionView::TestCase
include RenderERBUtils
tests ActionView::Helpers::FormHelper
class WithActiveStorageRoutesControllers < ActionController::Base
t... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/text_helper_test.rb | actionview/test/template/text_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class TextHelperTest < ActionView::TestCase
tests ActionView::Helpers::TextHelper
def setup
super
# This simulates the fact that instance variables are reset every time
# a view is rendered. The cycle helper depends on this behavior.
@_cycles... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/controller_helper_test.rb | actionview/test/template/controller_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ControllerHelperTest < ActionView::TestCase
tests ActionView::Helpers::ControllerHelper
class SpecializedFormBuilder < ActionView::Helpers::FormBuilder ; end
def test_assign_controller_sets_default_form_builder
@controller = Struct.new(:default_f... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/javascript_helper_test.rb | actionview/test/template/javascript_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class JavaScriptHelperTest < ActionView::TestCase
tests ActionView::Helpers::JavaScriptHelper
attr_accessor :output_buffer
attr_reader :request
setup do
@old_escape_html_entities_in_json = ActiveSupport.escape_html_entities_in_json
@old_auto_incl... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/test_case_test.rb | actionview/test/template/test_case_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "rails/engine"
require "capybara/minitest"
module ActionView
module ATestHelper
end
module AnotherTestHelper
def from_another_helper
"Howdy!"
end
end
module ASharedTestHelper
def from_shared_helper
"Holla!"
end
end... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/asset_tag_helper_test.rb | actionview/test/template/asset_tag_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/ordered_options"
require "action_dispatch"
ActionView::Template.mime_types_implementation = Mime
module AssetTagHelperTestHelpers
def with_preload_links_header(new_preload_links_header = true)
original_preload_links_header = ActionVi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/csrf_helper_test.rb | actionview/test/template/csrf_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class CsrfHelperTest < ActiveSupport::TestCase
cattr_accessor :request_forgery, default: false
include ActionView::Helpers::CsrfHelper
include ActionView::Helpers::TagHelper
include Rails::Dom::Testing::Assertions::DomAssertions
def test_csrf_meta_tags... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/render_test.rb | actionview/test/template/render_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_models"
require "test_renderable"
require "active_model/validations"
class TestController < ActionController::Base
end
module RenderTestCases
def setup_view(paths)
@assigns = { secret: "in the sauce" }
@view = Class.new(ActionV... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/form_tag_helper_test.rb | actionview/test/template/form_tag_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/core_ext/object/with"
class FormTagHelperTest < ActionView::TestCase
include RenderERBUtils
tests ActionView::Helpers::FormTagHelper
class WithActiveStorageRoutesControllers < ActionController::Base
test_routes do
post "/r... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/html_test.rb | actionview/test/template/html_test.rb | # frozen_string_literal: true
require "abstract_unit"
class HTMLTest < ActiveSupport::TestCase
test "formats returns symbol for recognized MIME type" do
assert_equal :html, ActionView::Template::HTML.new("", :html).format
end
test "formats returns string for recognized MIME type when MIME does not have sym... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/date_helper_test.rb | actionview/test/template/date_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/core_ext/integer/time"
class DateHelperTest < ActionView::TestCase
tests ActionView::Helpers::DateHelper
silence_warnings do
Post = Struct.new("Post", :id, :written_on, :updated_at)
Post.class_eval do
def id
123
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/resolver_shared_tests.rb | actionview/test/template/resolver_shared_tests.rb | # frozen_string_literal: true
module ResolverSharedTests
attr_reader :tmpdir
def run(*args)
capture_exceptions do
Dir.mktmpdir(nil, __dir__) { |dir| @tmpdir = dir; super }
end
end
def with_file(filename, source = "File at #{filename}")
path = File.join(tmpdir, filename)
FileUtils.mkdir_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/text_test.rb | actionview/test/template/text_test.rb | # frozen_string_literal: true
require "abstract_unit"
class TextTest < ActiveSupport::TestCase
test "format always return :text" do
assert_equal :text, ActionView::Template::Text.new("").format
end
test "identifier should return 'text template'" do
assert_equal "text template", ActionView::Template::Te... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/file_system_resolver_test.rb | actionview/test/template/file_system_resolver_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "template/resolver_shared_tests"
class FileSystemResolverTest < ActiveSupport::TestCase
include ResolverSharedTests
def resolver
ActionView::FileSystemResolver.new(tmpdir)
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/atom_feed_helper_test.rb | actionview/test/template/atom_feed_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
Scroll = Struct.new(:id, :to_param, :title, :body, :updated_at, :created_at) do
extend ActiveModel::Naming
include ActiveModel::Conversion
def persisted?
false
end
end
class ScrollsController < ActionController::Base
FEEDS = {}
FEEDS["defaults"] ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/date_helper_i18n_test.rb | actionview/test/template/date_helper_i18n_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/core_ext/integer/time"
class DateHelperDistanceOfTimeInWordsI18nTests < ActiveSupport::TestCase
include ActionView::Helpers::DateHelper
attr_reader :request
def setup
@from = Time.utc(2004, 6, 6, 21, 45, 0)
end
# distance_of... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/output_safety_helper_test.rb | actionview/test/template/output_safety_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class OutputSafetyHelperTest < ActionView::TestCase
tests ActionView::Helpers::OutputSafetyHelper
def setup
@string = "hello"
end
test "raw returns the safe string" do
result = raw(@string)
assert_equal @string, result
assert_predicate re... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/form_options_helper_i18n_test.rb | actionview/test/template/form_options_helper_i18n_test.rb | # frozen_string_literal: true
require "abstract_unit"
class FormOptionsHelperI18nTests < ActionView::TestCase
tests ActionView::Helpers::FormOptionsHelper
def setup
@prompt_message = "Select!"
I18n.backend.send(:init_translations)
I18n.backend.store_translations :en, helpers: { select: { prompt: @pro... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/capture_helper_test.rb | actionview/test/template/capture_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class CaptureHelperTest < ActionView::TestCase
def setup
super
@av = ActionView::Base.empty
@view_flow = ActionView::OutputFlow.new
end
def test_capture_captures_the_temporary_output_buffer_in_its_block
assert_predicate @av.output_buffer, :e... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/active_model_helper_test.rb | actionview/test/template/active_model_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ActiveModelHelperTest < ActionView::TestCase
tests ActionView::Helpers::ActiveModelHelper
silence_warnings do
Post = Struct.new(:author_name, :body, :category, :published, :updated_at) do
include ActiveModel::Conversion
include ActiveMod... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/erb_util_test.rb | actionview/test/template/erb_util_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/json"
require "active_support/core_ext/erb/util"
class ErbUtilTest < ActiveSupport::TestCase
include ERB::Util
ERB::Util::HTML_ESCAPE.each do |given, expected|
define_method "test_html_escape_#{expected.gsub(/\W/, '')}" do
as... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/form_helper/form_with_test.rb | actionview/test/template/form_helper/form_with_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "controller/fake_models"
class FormWithTest < ActionView::TestCase
include RenderERBUtils
setup do
@old_value = ActionView::Helpers::FormHelper.form_with_generates_ids
ActionView::Helpers::FormHelper.form_with_generates_ids = true
end
tea... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/testing/null_resolver_test.rb | actionview/test/template/testing/null_resolver_test.rb | # frozen_string_literal: true
require "abstract_unit"
class NullResolverTest < ActiveSupport::TestCase
def test_should_return_template_for_any_path
resolver = ActionView::NullResolver.new()
templates = resolver.find_all("path.erb", "arbitrary", false, locale: [], formats: [:html], handlers: [])
assert_e... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/testing/fixture_resolver_test.rb | actionview/test/template/testing/fixture_resolver_test.rb | # frozen_string_literal: true
require "abstract_unit"
class FixtureResolverTest < ActiveSupport::TestCase
def test_should_return_empty_list_for_unknown_path
resolver = ActionView::FixtureResolver.new()
templates = resolver.find_all("path", "arbitrary", false, locale: [], formats: [:html], variants: [], hand... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/erb/tag_helper_test.rb | actionview/test/template/erb/tag_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "template/erb/helper"
module ERBTest
class TagHelperTest < BlockTestCase
test "percent equals works for content_tag and does not require parenthesis on method call" do
assert_equal "<div>Hello world</div>", render_content("content_tag :div", "H... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/erb/erubi_test.rb | actionview/test/template/erb/erubi_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_view/template/handlers/erb/erubi"
class ErubiTest < ActiveSupport::TestCase
test "can configure bufvar" do
template = <<~ERB
foo
<%= "foo".upcase %>
<%== "foo".length %>
ERB
baseline = ActionView::Template::Handle... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/erb/form_for_test.rb | actionview/test/template/erb/form_for_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "template/erb/helper"
module ERBTest
class TagHelperTest < BlockTestCase
test "form_for works" do
routes = ActionDispatch::Routing::RouteSet.new
routes.draw do
get "/blah/update", to: "blah#update"
end
output = render_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/template/erb/helper.rb | actionview/test/template/erb/helper.rb | # frozen_string_literal: true
module ERBTest
class ViewContext
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::TagHelper
include ActionView::Helpers::JavaScriptHelper
include ActionView::Helpers::FormHelper
attr_accessor :output_buffer, :controller
def protect_against_fo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/actionpack/controller/layout_test.rb | actionview/test/actionpack/controller/layout_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/core_ext/array/extract_options"
# The view_paths array must be set on Base and not LayoutTest so that LayoutTest's inherited
# method has access to the view_paths array when looking for a layout to automatically assign.
old_load_paths = Act... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/actionpack/controller/capture_test.rb | actionview/test/actionpack/controller/capture_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/logger"
class CaptureController < ActionController::Base
self.view_paths = [ File.expand_path("../../fixtures/actionpack", __dir__) ]
def self.controller_path; "test"; end
def content_for
@title = nil
render layout: "talk_fr... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/actionpack/controller/render_test.rb | actionview/test/actionpack/controller/render_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_model"
require "controller/fake_models"
module Quiz
# Models
Question = Struct.new(:name, :id) do
extend ActiveModel::Naming
include ActiveModel::Conversion
def persisted?
id.present?
end
end
# Controller
class Que... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/actionpack/controller/view_paths_test.rb | actionview/test/actionpack/controller/view_paths_test.rb | # frozen_string_literal: true
require "abstract_unit"
class ViewLoadPathsTest < ActionController::TestCase
class TestController < ActionController::Base
def self.controller_path() "test" end
before_action :add_view_path, only: :hello_world_at_request_time
def hello_world() end
def hello_world_at_r... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/actionpack/abstract/abstract_controller_test.rb | actionview/test/actionpack/abstract/abstract_controller_test.rb | # frozen_string_literal: true
require "abstract_unit"
module AbstractController
module Testing
# Test basic dispatching.
# ====
# * Call process
# * Test that the response_body is set correctly
class SimpleController < AbstractController::Base
end
class Me < SimpleController
def i... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/actionpack/abstract/helper_test.rb | actionview/test/actionpack/abstract/helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
ActionController::Base.helpers_path = File.expand_path("../../fixtures/helpers", __dir__)
module AbstractController
module Testing
class ControllerWithHelpers < AbstractController::Base
include AbstractController::Helpers
include AbstractControl... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/actionpack/abstract/render_test.rb | actionview/test/actionpack/abstract/render_test.rb | # frozen_string_literal: true
require "abstract_unit"
module AbstractController
module Testing
class ControllerRenderer < AbstractController::Base
include AbstractController::Rendering
include ActionView::Rendering
def _prefixes
%w[renderer]
end
self.view_paths = [ActionV... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/test/actionpack/abstract/layouts_test.rb | actionview/test/actionpack/abstract/layouts_test.rb | # frozen_string_literal: true
require "abstract_unit"
module AbstractControllerTests
module Layouts
# Base controller for these tests
class Base < AbstractController::Base
include AbstractController::Rendering
include ActionView::Rendering
include ActionView::Layouts
abstract!
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view.rb | actionview/lib/action_view.rb | # frozen_string_literal: true
#--
# Copyright (c) David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/path_set.rb | actionview/lib/action_view/path_set.rb | # frozen_string_literal: true
module ActionView # :nodoc:
# = Action View PathSet
#
# This class is used to store and access paths in Action View. A number of
# operations are defined so that you can search among the paths in this
# set and also perform operations on other +PathSet+ objects.
#
# A +Looku... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/model_naming.rb | actionview/lib/action_view/model_naming.rb | # frozen_string_literal: true
module ActionView
module ModelNaming # :nodoc:
# Converts the given object to an Active Model compliant one.
def convert_to_model(object)
object.respond_to?(:to_model) ? object.to_model : object
end
def model_name_from_record_or_class(record_or_class)
conver... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/test_case.rb | actionview/lib/action_view/test_case.rb | # frozen_string_literal: true
require "active_support/core_ext/module/redefine_method"
require "action_controller"
require "action_controller/test_case"
require "action_view"
require "rails-dom-testing"
module ActionView
# = Action View Test Case
#
# Read more about <tt>ActionView::TestCase</tt> in {Testing Ra... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/version.rb | actionview/lib/action_view/version.rb | # frozen_string_literal: true
require_relative "gem_version"
module ActionView
# Returns the currently loaded version of Action View as a +Gem::Version+.
def self.version
gem_version
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/unbound_template.rb | actionview/lib/action_view/unbound_template.rb | # frozen_string_literal: true
require "concurrent/map"
module ActionView
class UnboundTemplate
attr_reader :virtual_path, :details
delegate :locale, :format, :variant, :handler, to: :@details
def initialize(source, identifier, details:, virtual_path:)
@source = source
@identifier = identifi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/template_details.rb | actionview/lib/action_view/template_details.rb | # frozen_string_literal: true
module ActionView
class TemplateDetails # :nodoc:
class Requested
attr_reader :locale, :handlers, :formats, :variants
attr_reader :locale_idx, :handlers_idx, :formats_idx, :variants_idx
ANY_HASH = Hash.new(1).merge(nil => 0).freeze
def initialize(locale:, h... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/routing_url_for.rb | actionview/lib/action_view/routing_url_for.rb | # frozen_string_literal: true
require "action_dispatch/routing/polymorphic_routes"
module ActionView
module RoutingUrlFor
# Returns the URL for the set of +options+ provided. This takes the
# same options as +url_for+ in Action Controller (see the
# documentation for ActionDispatch::Routing::UrlFor#url_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/log_subscriber.rb | actionview/lib/action_view/log_subscriber.rb | # frozen_string_literal: true
require "active_support/log_subscriber"
module ActionView
class LogSubscriber < ActiveSupport::EventReporter::LogSubscriber # :nodoc:
VIEWS_PATTERN = /^app\/views\//
self.namespace = "action_view"
def initialize
@root = nil
super
end
def render_templa... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/layouts.rb | actionview/lib/action_view/layouts.rb | # frozen_string_literal: true
require "action_view/rendering"
require "active_support/core_ext/module/redefine_method"
module ActionView
# = Action View \Layouts
#
# Layouts reverse the common pattern of including shared headers and footers in many templates to isolate changes in
# repeated setups. The inclus... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/flows.rb | actionview/lib/action_view/flows.rb | # frozen_string_literal: true
require "active_support/core_ext/string/output_safety"
module ActionView
class OutputFlow # :nodoc:
attr_reader :content
def initialize
@content = Hash.new { |h, k| h[k] = ActiveSupport::SafeBuffer.new }
end
# Called by _layout_for to read stored values.
def... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/record_identifier.rb | actionview/lib/action_view/record_identifier.rb | # frozen_string_literal: true
require "active_support/core_ext/module"
require "action_view/model_naming"
module ActionView
# = Action View \Record \Identifier
#
# RecordIdentifier encapsulates methods used by various ActionView helpers
# to associate records with DOM elements.
#
# Consider for example th... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/lookup_context.rb | actionview/lib/action_view/lookup_context.rb | # frozen_string_literal: true
require "concurrent/map"
require "active_support/core_ext/module/attribute_accessors"
require "action_view/template/resolver"
module ActionView
# = Action View Lookup Context
#
# <tt>LookupContext</tt> is the object responsible for holding all information
# required for looking u... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/buffers.rb | actionview/lib/action_view/buffers.rb | # frozen_string_literal: true
require "active_support/core_ext/string/output_safety"
module ActionView
# Used as a buffer for views
#
# The main difference between this and ActiveSupport::SafeBuffer
# is for the methods `<<` and `safe_expr_append=` the inputs are
# checked for nil before they are assigned a... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/rendering.rb | actionview/lib/action_view/rendering.rb | # frozen_string_literal: true
require "action_view/view_paths"
module ActionView
# This is a class to fix I18n global state. Whenever you provide I18n.locale during a request,
# it will trigger the lookup_context and consequently expire the cache.
class I18nProxy < ::I18n::Config # :nodoc:
attr_reader :orig... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/structured_event_subscriber.rb | actionview/lib/action_view/structured_event_subscriber.rb | # frozen_string_literal: true
require "active_support/structured_event_subscriber"
module ActionView
class StructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber # :nodoc:
VIEWS_PATTERN = /^app\/views\//
def initialize
@root = nil
super
end
def render_template(event)
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/helpers.rb | actionview/lib/action_view/helpers.rb | # frozen_string_literal: true
require "active_support/benchmarkable"
require "action_view/helpers/capture_helper"
require "action_view/helpers/output_safety_helper"
require "action_view/helpers/tag_helper"
require "action_view/helpers/url_helper"
require "action_view/helpers/sanitize_helper"
require "action_view/helpe... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/dependency_tracker.rb | actionview/lib/action_view/dependency_tracker.rb | # frozen_string_literal: true
require "concurrent/map"
require "action_view/path_set"
require "action_view/render_parser"
module ActionView
class DependencyTracker # :nodoc:
extend ActiveSupport::Autoload
autoload :ERBTracker
autoload :RubyTracker
autoload :WildcardResolver
@trackers = Concurr... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/railtie.rb | actionview/lib/action_view/railtie.rb | # frozen_string_literal: true
require "rails"
require "action_view"
module ActionView
# = Action View Railtie
class Railtie < Rails::Engine # :nodoc:
config.action_view = ActiveSupport::OrderedOptions.new
config.action_view.embed_authenticity_token_in_remote_forms = nil
config.action_view.debug_missin... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/cache_expiry.rb | actionview/lib/action_view/cache_expiry.rb | # frozen_string_literal: true
module ActionView
module CacheExpiry # :nodoc: all
class ViewReloader
def initialize(watcher:, &block)
@mutex = Mutex.new
@watcher_class = watcher
@watched_dirs = nil
@watcher = nil
@previous_change = false
ActionView::PathRegis... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/base.rb | actionview/lib/action_view/base.rb | # frozen_string_literal: true
require "active_support/core_ext/module/attr_internal"
require "active_support/core_ext/module/attribute_accessors"
require "active_support/ordered_options"
require "action_view/log_subscriber"
require "action_view/structured_event_subscriber"
require "action_view/helpers"
require "action... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/digestor.rb | actionview/lib/action_view/digestor.rb | # frozen_string_literal: true
require "action_view/dependency_tracker"
module ActionView
class Digestor
@@digest_mutex = Mutex.new
class << self
# Supported options:
#
# * <tt>name</tt> - Template name
# * <tt>format</tt> - Template format
# * +finder+ ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/template.rb | actionview/lib/action_view/template.rb | # frozen_string_literal: true
require "delegate"
module ActionView
# = Action View \Template
class Template
extend ActiveSupport::Autoload
STRICT_LOCALS_REGEX = /\#\s+locals:\s+\((.*?)\)(?=\s*-?%>|\s*$)/m
# === Encodings in ActionView::Template
#
# ActionView::Template is one of a few source... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/view_paths.rb | actionview/lib/action_view/view_paths.rb | # frozen_string_literal: true
module ActionView
module ViewPaths
extend ActiveSupport::Concern
included do
ActionView::PathRegistry.set_view_paths(self, ActionView::PathSet.new.freeze)
end
delegate :template_exists?, :any_templates?, :view_paths, :formats, :formats=,
:locale, :lo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/template_path.rb | actionview/lib/action_view/template_path.rb | # frozen_string_literal: true
module ActionView
# = Action View \TemplatePath
#
# Represents a template path within ActionView's lookup and rendering system,
# like "users/show"
#
# TemplatePath makes it convenient to convert between separate name, prefix,
# partial arguments and the virtual path.
clas... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/deprecator.rb | actionview/lib/action_view/deprecator.rb | # frozen_string_literal: true
module ActionView
def self.deprecator # :nodoc:
@deprecator ||= ActiveSupport::Deprecation.new
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/context.rb | actionview/lib/action_view/context.rb | # frozen_string_literal: true
module ActionView
# = Action View Context
#
# Action View contexts are supplied to Action Controller to render a template.
# The default Action View context is ActionView::Base.
#
# In order to work with Action Controller, a Context must just include this
# module. The initi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/gem_version.rb | actionview/lib/action_view/gem_version.rb | # frozen_string_literal: true
module ActionView
# Returns the currently loaded version of Action View as a +Gem::Version+.
def self.gem_version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 8
MINOR = 2
TINY = 0
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/render_parser.rb | actionview/lib/action_view/render_parser.rb | # frozen_string_literal: true
module ActionView
module RenderParser # :nodoc:
ALL_KNOWN_KEYS = [:partial, :template, :layout, :formats, :locals, :object, :collection, :as, :status, :content_type, :location, :spacer_template]
RENDER_TYPE_KEYS = [:partial, :template, :layout]
class Base # :nodoc:
de... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/path_registry.rb | actionview/lib/action_view/path_registry.rb | # frozen_string_literal: true
module ActionView # :nodoc:
module PathRegistry # :nodoc:
@view_paths_by_class = {}
@file_system_resolvers = {}
@file_system_resolver_mutex = Mutex.new
@file_system_resolver_hooks = []
class << self
attr_reader :file_system_resolver_hooks
end
def self... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/renderer/partial_renderer.rb | actionview/lib/action_view/renderer/partial_renderer.rb | # frozen_string_literal: true
require "action_view/renderer/partial_renderer/collection_caching"
module ActionView
# = Action View Partials
#
# There's also a convenience method for rendering sub templates within the current controller that depends on a
# single object (we call this kind of sub templates for ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/renderer/abstract_renderer.rb | actionview/lib/action_view/renderer/abstract_renderer.rb | # frozen_string_literal: true
require "concurrent/map"
module ActionView
# This class defines the interface for a renderer. Each class that
# subclasses +AbstractRenderer+ is used by the base +Renderer+ class to
# render a specific type of object.
#
# The base +Renderer+ class uses its +render+ method to de... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/renderer/template_renderer.rb | actionview/lib/action_view/renderer/template_renderer.rb | # frozen_string_literal: true
module ActionView
class TemplateRenderer < AbstractRenderer # :nodoc:
def render(context, options)
@details = extract_details(options)
template = determine_template(options)
prepend_formats(template.format)
render_template(context, template, options[:layout... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/renderer/object_renderer.rb | actionview/lib/action_view/renderer/object_renderer.rb | # frozen_string_literal: true
module ActionView
class ObjectRenderer < PartialRenderer # :nodoc:
include ObjectRendering
def initialize(lookup_context, options)
super
@object = nil
@local_name = nil
end
def render_object_with_partial(object, partial, context, block)
@obj... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/renderer/collection_renderer.rb | actionview/lib/action_view/renderer/collection_renderer.rb | # frozen_string_literal: true
require "action_view/renderer/partial_renderer"
module ActionView
class PartialIteration
# The number of iterations that will be done by the partial.
attr_reader :size
# The current iteration of the partial.
attr_reader :index
def initialize(size)
@size = s... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/renderer/renderer.rb | actionview/lib/action_view/renderer/renderer.rb | # frozen_string_literal: true
module ActionView
# = Action View \Renderer
#
# This is the main entry point for rendering. It basically delegates
# to other objects like TemplateRenderer and PartialRenderer which
# actually renders the template.
#
# The Renderer will parse the options from the +render+ or... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/renderer/streaming_template_renderer.rb | actionview/lib/action_view/renderer/streaming_template_renderer.rb | # frozen_string_literal: true
module ActionView
# == TODO
#
# * Support streaming from child templates, partials and so on.
# * Rack::Cache needs to support streaming bodies
class StreamingTemplateRenderer < TemplateRenderer # :nodoc:
# A valid Rack::Body (i.e. it responds to each).
# It is initiali... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb | actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb | # frozen_string_literal: true
require "active_support/core_ext/enumerable"
module ActionView
module CollectionCaching # :nodoc:
extend ActiveSupport::Concern
included do
# Fallback cache store if Action View is used without Rails.
# Otherwise overridden in Railtie to use Rails.cache.
matt... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/dependency_tracker/ruby_tracker.rb | actionview/lib/action_view/dependency_tracker/ruby_tracker.rb | # frozen_string_literal: true
module ActionView
class DependencyTracker # :nodoc:
class RubyTracker # :nodoc:
EXPLICIT_DEPENDENCY = /# Template Dependency: (\S+)/
def self.call(name, template, view_paths = nil)
new(name, template, view_paths).dependencies
end
def dependencies
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionview/lib/action_view/dependency_tracker/erb_tracker.rb | actionview/lib/action_view/dependency_tracker/erb_tracker.rb | # frozen_string_literal: true
module ActionView
class DependencyTracker # :nodoc:
class ERBTracker # :nodoc:
EXPLICIT_DEPENDENCY = /# Template Dependency: (\S+)/
# A valid ruby identifier - suitable for class, method and specially variable names
IDENTIFIER = /
[[:alpha:]_] # at least o... | 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.