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/actionmailbox/test/unit/mailbox/state_test.rb | actionmailbox/test/unit/mailbox/state_test.rb | # frozen_string_literal: true
require_relative "../../test_helper"
class SuccessfulMailbox < ActionMailbox::Base
def process
$processed = mail.subject
end
end
class UnsuccessfulMailbox < ActionMailbox::Base
rescue_from(RuntimeError) { $processed = :failure }
def process
raise "No way!"
end
end
cl... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/test/unit/mailbox/notifications_test.rb | actionmailbox/test/unit/mailbox/notifications_test.rb | # frozen_string_literal: true
require_relative "../../test_helper"
class RepliesMailbox < ActionMailbox::Base
end
class ActionMailbox::Base::NotificationsTest < ActiveSupport::TestCase
test "instruments processing" do
mailbox = RepliesMailbox.new(create_inbound_email_from_fixture("welcome.eml"))
expected_p... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/test/unit/mailbox/callbacks_test.rb | actionmailbox/test/unit/mailbox/callbacks_test.rb | # frozen_string_literal: true
require_relative "../../test_helper"
class CallbackMailbox < ActionMailbox::Base
before_processing { $before_processing = "Ran that!" }
after_processing { $after_processing = "Ran that too!" }
around_processing ->(r, block) { block.call; $around_processing = "Ran that as well!" }
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/test/unit/mail_ext/address_equality_test.rb | actionmailbox/test/unit/mail_ext/address_equality_test.rb | # frozen_string_literal: true
require_relative "../../test_helper"
module MailExt
class AddressEqualityTest < ActiveSupport::TestCase
test "two addresses with the same address are equal" do
assert_equal Mail::Address.new("david@basecamp.com"), Mail::Address.new("david@basecamp.com")
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/test/unit/mail_ext/addresses_test.rb | actionmailbox/test/unit/mail_ext/addresses_test.rb | # frozen_string_literal: true
require_relative "../../test_helper"
module MailExt
class AddressesTest < ActiveSupport::TestCase
setup do
@mail = Mail.new \
from: "sally@example.com",
reply_to: "sarah@example.com",
to: "david@basecamp.com",
cc: "jason@basecamp.com",
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/test/unit/mail_ext/address_wrapping_test.rb | actionmailbox/test/unit/mail_ext/address_wrapping_test.rb | # frozen_string_literal: true
require_relative "../../test_helper"
module MailExt
class AddressWrappingTest < ActiveSupport::TestCase
test "wrap" do
needing_wrapping = Mail::Address.wrap("david@basecamp.com")
wrapping_not_needed = Mail::Address.wrap(Mail::Address.new("david@basecamp.com"))
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox.rb | actionmailbox/lib/action_mailbox.rb | # frozen_string_literal: true
require "active_support"
require "active_support/rails"
require "active_support/core_ext/numeric/time"
require "action_mailbox/version"
require "action_mailbox/deprecator"
require "action_mailbox/mail_ext"
# :markup: markdown
# :include: ../README.md
module ActionMailbox
extend Active... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/rails/generators/mailbox/mailbox_generator.rb | actionmailbox/lib/rails/generators/mailbox/mailbox_generator.rb | # frozen_string_literal: true
module Rails
module Generators
class MailboxGenerator < NamedBase
source_root File.expand_path("templates", __dir__)
check_class_collision suffix: "Mailbox"
def create_mailbox_file
template "mailbox.rb", File.join("app/mailboxes", class_path, "#{file_name... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/rails/generators/test_unit/mailbox_generator.rb | actionmailbox/lib/rails/generators/test_unit/mailbox_generator.rb | # frozen_string_literal: true
module TestUnit
module Generators
class MailboxGenerator < ::Rails::Generators::NamedBase
source_root File.expand_path("templates", __dir__)
check_class_collision suffix: "MailboxTest"
def create_test_files
template "mailbox_test.rb", File.join("test/mail... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/generators/action_mailbox/install/install_generator.rb | actionmailbox/lib/generators/action_mailbox/install/install_generator.rb | # frozen_string_literal: true
require "rails/generators/mailbox/mailbox_generator"
module ActionMailbox
module Generators
class InstallGenerator < ::Rails::Generators::Base
source_root Rails::Generators::MailboxGenerator.source_root
def create_action_mailbox_files
say "Copying application_m... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/test_case.rb | actionmailbox/lib/action_mailbox/test_case.rb | # frozen_string_literal: true
require "action_mailbox/test_helper"
require "active_support/test_case"
module ActionMailbox
class TestCase < ActiveSupport::TestCase
include ActionMailbox::TestHelper
end
end
ActiveSupport.run_load_hooks :action_mailbox_test_case, ActionMailbox::TestCase
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/version.rb | actionmailbox/lib/action_mailbox/version.rb | # frozen_string_literal: true
require_relative "gem_version"
module ActionMailbox
# Returns the currently loaded version of Action Mailbox 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/actionmailbox/lib/action_mailbox/relayer.rb | actionmailbox/lib/action_mailbox/relayer.rb | # frozen_string_literal: true
require "action_mailbox/version"
require "net/http"
require "uri"
module ActionMailbox
class Relayer
class Result < Struct.new(:status_code, :message)
def success?
!failure?
end
def failure?
transient_failure? || permanent_failure?
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/routing.rb | actionmailbox/lib/action_mailbox/routing.rb | # frozen_string_literal: true
module ActionMailbox
# See ActionMailbox::Base for how to specify routing.
module Routing
extend ActiveSupport::Concern
included do
cattr_accessor :router, default: ActionMailbox::Router.new
end
class_methods do
def routing(routes)
router.add_rout... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/router.rb | actionmailbox/lib/action_mailbox/router.rb | # frozen_string_literal: true
module ActionMailbox
# = Action Mailbox \Router
#
# Encapsulates the routes that live on the ApplicationMailbox and performs the actual routing when
# an inbound_email is received.
class Router
class RoutingError < StandardError; end
def initialize
@routes = []
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/callbacks.rb | actionmailbox/lib/action_mailbox/callbacks.rb | # frozen_string_literal: true
require "active_support/callbacks"
module ActionMailbox
# = Action Mailbox \Callbacks
#
# Defines the callbacks related to processing.
module Callbacks
extend ActiveSupport::Concern
include ActiveSupport::Callbacks
TERMINATOR = ->(mailbox, chain) do
chain.call... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/base.rb | actionmailbox/lib/action_mailbox/base.rb | # frozen_string_literal: true
require "active_support/rescuable"
require "action_mailbox/callbacks"
require "action_mailbox/routing"
module ActionMailbox
# = Action Mailbox \Base
#
# The base class for all application mailboxes. Not intended to be inherited from directly. Inherit from
# +ApplicationMailbox+ ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/test_helper.rb | actionmailbox/lib/action_mailbox/test_helper.rb | # frozen_string_literal: true
require "mail"
module ActionMailbox
module TestHelper
# Create an InboundEmail record using an eml fixture in the format of message/rfc822
# referenced with +fixture_name+ located in +test/fixtures/files/fixture_name+.
def create_inbound_email_from_fixture(fixture_name, sta... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/mail_ext.rb | actionmailbox/lib/action_mailbox/mail_ext.rb | # frozen_string_literal: true
require "mail"
# The hope is to upstream most of these basic additions to the Mail gem's Mail object. But until then, here they lay!
Dir["#{File.expand_path(File.dirname(__FILE__))}/mail_ext/*"].each { |path| require "action_mailbox/mail_ext/#{File.basename(path)}" }
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/deprecator.rb | actionmailbox/lib/action_mailbox/deprecator.rb | # frozen_string_literal: true
module ActionMailbox
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/actionmailbox/lib/action_mailbox/engine.rb | actionmailbox/lib/action_mailbox/engine.rb | # frozen_string_literal: true
require "rails"
require "action_controller/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_mailbox"
module ActionMailbox
class Engine < Rails::Engine
isolate_namespace ActionMailbox
config.eager_load_namespa... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/gem_version.rb | actionmailbox/lib/action_mailbox/gem_version.rb | # frozen_string_literal: true
module ActionMailbox
# Returns the currently loaded version of Action Mailbox 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].co... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/mail_ext/address_wrapping.rb | actionmailbox/lib/action_mailbox/mail_ext/address_wrapping.rb | # frozen_string_literal: true
module Mail
class Address
def self.wrap(address)
address.is_a?(Mail::Address) ? address : Mail::Address.new(address)
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/mail_ext/addresses.rb | actionmailbox/lib/action_mailbox/mail_ext/addresses.rb | # frozen_string_literal: true
module Mail
class Message
def from_address
address_list(header[:from])&.addresses&.first
end
def reply_to_address
address_list(header[:reply_to])&.addresses&.first
end
def recipients_addresses
to_addresses + cc_addresses + bcc_addresses + x_origin... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/mail_ext/address_equality.rb | actionmailbox/lib/action_mailbox/mail_ext/address_equality.rb | # frozen_string_literal: true
module Mail
class Address
def ==(other_address)
other_address.is_a?(Mail::Address) && to_s == other_address.to_s
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/mail_ext/recipients.rb | actionmailbox/lib/action_mailbox/mail_ext/recipients.rb | # frozen_string_literal: true
module Mail
class Message
def recipients
Array(to) + Array(cc) + Array(bcc) + Array(header[:x_original_to]).map(&:to_s) +
Array(header[:x_forwarded_to]).map(&:to_s)
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/mail_ext/from_source.rb | actionmailbox/lib/action_mailbox/mail_ext/from_source.rb | # frozen_string_literal: true
module Mail
def self.from_source(source)
Mail.new Mail::Utilities.binary_unsafe_to_crlf(source.to_s)
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/lib/action_mailbox/router/route.rb | actionmailbox/lib/action_mailbox/router/route.rb | # frozen_string_literal: true
module ActionMailbox
# Encapsulates a route, which can then be matched against an inbound_email and provide a lookup of the matching
# mailbox class. See examples for the different route addresses and how to use them in the ActionMailbox::Base
# documentation.
class Router::Route
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailbox/config/routes.rb | actionmailbox/config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
scope "/rails/action_mailbox", module: "action_mailbox/ingresses" do
post "/postmark/inbound_emails" => "postmark/inbound_emails#create", as: :rails_postmark_inbound_emails
post "/relay/inbound_emails" => "relay/inbound_emails#create", as: ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/delivery_methods_test.rb | actionmailer/test/delivery_methods_test.rb | # frozen_string_literal: true
require "abstract_unit"
class MyCustomDelivery
end
class MyOptionedDelivery
attr_reader :options
def initialize(options)
@options = options
end
end
class BogusDelivery
def initialize(*)
end
def deliver!(mail)
raise "failed"
end
end
class DefaultsDeliveryMethodsT... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/i18n_with_controller_test.rb | actionmailer/test/i18n_with_controller_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_view"
require "action_controller"
class I18nTestMailer < ActionMailer::Base
configure do |c|
c.assets_dir = ""
end
def mail_with_i18n_subject(recipient)
@recipient = recipient
I18n.locale = :de
mail(to: recipient, subject: I... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/mail_helper_test.rb | actionmailer/test/mail_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
class HelperMailer < ActionMailer::Base
def use_mail_helper
@text = "But soft! What light through yonder window breaks? It is the east, " \
"and Juliet is the sun. Arise, fair sun, and kill the envious moon, " \
"which is sick and pal... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/structured_event_subscriber_test.rb | actionmailer/test/structured_event_subscriber_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/testing/event_reporter_assertions"
require "mailers/base_mailer"
require "action_mailer/structured_event_subscriber"
module ActionMailer
class StructuredEventSubscriberTest < ActionMailer::TestCase
include ActiveSupport::Testing::Even... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/mail_layout_test.rb | actionmailer/test/mail_layout_test.rb | # frozen_string_literal: true
require "abstract_unit"
class AutoLayoutMailer < ActionMailer::Base
default to: "test@localhost",
subject: "You have a mail",
from: "tester@example.com"
def hello
mail()
end
def spam
@world = "Earth"
mail(body: render(inline: "Hello, <%= @world %>", layout: ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/log_subscriber_test.rb | actionmailer/test/log_subscriber_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "mailers/base_mailer"
require "active_support/log_subscriber/test_helper"
require "action_mailer/log_subscriber"
require "active_support/testing/event_reporter_assertions"
require "action_mailer/structured_event_subscriber"
class AMLogSubscriberTest < Acti... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/test_helper_test.rb | actionmailer/test/test_helper_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_support/testing/stream"
class TestHelperMailer < ActionMailer::Base
def test
@world = "Earth"
mail body: render(inline: "Hello, <%= @world %>"),
subject: "Hi!",
to: "test@example.com",
from: "tester@example.com"
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/parameterized_test.rb | actionmailer/test/parameterized_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_job"
require "mailers/params_mailer"
class ParameterizedTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
class DummyDeliveryJob < ActionMailer::MailDeliveryJob
end
setup do
@previous_logger = ActiveJob::Base.logger
Act... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/caching_test.rb | actionmailer/test/caching_test.rb | # frozen_string_literal: true
require "fileutils"
require "abstract_unit"
require "mailers/base_mailer"
require "mailers/caching_mailer"
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 F... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/assert_select_email_test.rb | actionmailer/test/assert_select_email_test.rb | # frozen_string_literal: true
require "abstract_unit"
class AssertSelectEmailTest < ActionMailer::TestCase
class AssertSelectMailer < ActionMailer::Base
def test(html)
mail body: html, content_type: "text/html",
subject: "Test e-mail", from: "test@test.host", to: "test <test@test.host>"
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/test_case_test.rb | actionmailer/test/test_case_test.rb | # frozen_string_literal: true
require "abstract_unit"
class TestTestMailer < ActionMailer::Base
end
class ClearTestDeliveriesMixinTest < ActiveSupport::TestCase
include ActionMailer::TestCase::ClearTestDeliveries
def before_setup
ActionMailer::Base.delivery_method, @original_delivery_method = :test, ActionM... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/form_builder_test.rb | actionmailer/test/form_builder_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "mailers/form_builder_mailer"
class MailerFormBuilderTest < ActiveSupport::TestCase
def test_default_form_builder_assigned
email = FormBuilderMailer.welcome
assert_includes(email.body.encoded, "hi from SpecializedFormBuilder")
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/abstract_unit.rb | actionmailer/test/abstract_unit.rb | # frozen_string_literal: true
require_relative "../../tools/strict_warnings"
require "active_support/core_ext/kernel/reporting"
# These are the normal settings that will be set up by Railties
# TODO: Have these tests support other combinations of these values
silence_warnings do
Encoding.default_internal = Encoding... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/base_test.rb | actionmailer/test/base_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_dispatch"
require "active_support/time"
require "mailers/base_mailer"
require "mailers/proc_mailer"
require "mailers/asset_mailer"
class BaseTest < ActiveSupport::TestCase
include Rails::Dom::Testing::Assertions::DomAssertions
setup do
@... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/url_test.rb | actionmailer/test/url_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller"
class WelcomeController < ActionController::Base
end
AppRoutes = ActionDispatch::Routing::RouteSet.new
AppRoutes.draw do
get "/welcome" => "foo#bar", as: "welcome"
get "/dummy_model" => "foo#baz", as: "dummy_model"
get "/welcome... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/callbacks_test.rb | actionmailer/test/callbacks_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "mailers/callback_mailer"
require "active_support/testing/stream"
class ActionMailerCallbacksTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
include ActiveSupport::Testing::Stream
setup do
@previous_delivery_method = ActionMailer::B... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/asset_host_test.rb | actionmailer/test/asset_host_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "action_controller"
class AssetHostMailer < ActionMailer::Base
def email_with_asset
mail to: "test@localhost",
subject: "testing email containing asset path while asset_host is set",
from: "tester@example.com"
end
end
class AssetHostTe... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/message_delivery_test.rb | actionmailer/test/message_delivery_test.rb | # frozen_string_literal: true
require "abstract_unit"
require "active_job"
require "mailers/base_mailer"
require "mailers/delayed_mailer"
require "mailers/params_mailer"
class MessageDeliveryTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
setup do
@previous_logger = ActiveJob::Base.logger
@p... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/mailers/caching_mailer.rb | actionmailer/test/mailers/caching_mailer.rb | # frozen_string_literal: true
class CachingMailer < ActionMailer::Base
self.mailer_name = "caching_mailer"
def fragment_cache
mail(subject: "welcome", template_name: "fragment_cache")
end
def fragment_cache_in_partials
mail(subject: "welcome", template_name: "fragment_cache_in_partials")
end
def... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/mailers/params_mailer.rb | actionmailer/test/mailers/params_mailer.rb | # frozen_string_literal: true
class ParamsMailer < ActionMailer::Base
before_action { @inviter, @invitee = params[:inviter], params[:invitee] }
default to: Proc.new { @invitee }, from: -> { @inviter }
def invitation
mail(subject: "Welcome to the project!") do |format|
format.text { render plain: "So ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/mailers/base_mailer.rb | actionmailer/test/mailers/base_mailer.rb | # frozen_string_literal: true
class BaseMailer < ActionMailer::Base
self.mailer_name = "base_mailer"
default to: "system@test.lindsaar.net",
from: "jose@test.plataformatec.com",
reply_to: email_address_with_name("mikel@test.lindsaar.net", "Mikel")
def welcome(hash = {})
headers["X-SPAM"... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/mailers/callback_mailer.rb | actionmailer/test/mailers/callback_mailer.rb | # frozen_string_literal: true
CallbackMailerError = Class.new(StandardError)
class CallbackMailer < ActionMailer::Base
cattr_accessor :rescue_from_error
cattr_accessor :after_deliver_instance
cattr_accessor :around_deliver_instance
cattr_accessor :abort_before_deliver
cattr_accessor :around_handles_error
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/mailers/proc_mailer.rb | actionmailer/test/mailers/proc_mailer.rb | # frozen_string_literal: true
class ProcMailer < ActionMailer::Base
default to: "system@test.lindsaar.net",
"X-Proc-Method" => Proc.new { Time.now.to_i.to_s },
subject: Proc.new { give_a_greeting },
"x-has-to-proc" => :symbol,
"X-Lambda-Arity-0" => ->() { "0" },
"X-L... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/mailers/form_builder_mailer.rb | actionmailer/test/mailers/form_builder_mailer.rb | # frozen_string_literal: true
class FormBuilderMailer < ActionMailer::Base
class SpecializedFormBuilder < ActionView::Helpers::FormBuilder
def message
"hi from SpecializedFormBuilder"
end
end
default_form_builder SpecializedFormBuilder
def welcome
mail(to: "email@example.com")
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/mailers/asset_mailer.rb | actionmailer/test/mailers/asset_mailer.rb | # frozen_string_literal: true
class AssetMailer < ActionMailer::Base
self.mailer_name = "asset_mailer"
def welcome
mail
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/test/mailers/delayed_mailer.rb | actionmailer/test/mailers/delayed_mailer.rb | # frozen_string_literal: true
class DelayedMailerError < StandardError; end
class DelayedMailer < ActionMailer::Base
self.deliver_later_queue_name = :delayed_mailers
cattr_accessor :last_error
cattr_accessor :last_rescue_from_instance
rescue_from DelayedMailerError do |error|
@@last_error = error
@@... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer.rb | actionmailer/lib/action_mailer.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/actionmailer/lib/rails/generators/mailer/mailer_generator.rb | actionmailer/lib/rails/generators/mailer/mailer_generator.rb | # frozen_string_literal: true
module Rails
module Generators
class MailerGenerator < NamedBase
source_root File.expand_path("templates", __dir__)
argument :actions, type: :array, default: [], banner: "method method"
check_class_collision suffix: "Mailer"
def create_mailer_file
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/test_case.rb | actionmailer/lib/action_mailer/test_case.rb | # frozen_string_literal: true
require "active_support/test_case"
require "rails-dom-testing"
module ActionMailer
class NonInferrableMailerError < ::StandardError
def initialize(name)
super "Unable to determine the mailer to test from #{name}. " \
"You'll need to specify it using tests YourMailer i... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/version.rb | actionmailer/lib/action_mailer/version.rb | # frozen_string_literal: true
require_relative "gem_version"
module ActionMailer
# Returns the currently loaded version of Action Mailer 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/actionmailer/lib/action_mailer/rescuable.rb | actionmailer/lib/action_mailer/rescuable.rb | # frozen_string_literal: true
module ActionMailer # :nodoc:
# = Action Mailer \Rescuable
#
# Provides
# {rescue_from}[rdoc-ref:ActiveSupport::Rescuable::ClassMethods#rescue_from]
# for mailers. Wraps mailer action processing, mail job processing, and mail
# delivery to handle configured errors.
module Re... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/queued_delivery.rb | actionmailer/lib/action_mailer/queued_delivery.rb | # frozen_string_literal: true
module ActionMailer
module QueuedDelivery
extend ActiveSupport::Concern
included do
class_attribute :delivery_job, default: ::ActionMailer::MailDeliveryJob
class_attribute :deliver_later_queue_name, default: :mailers
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/log_subscriber.rb | actionmailer/lib/action_mailer/log_subscriber.rb | # frozen_string_literal: true
require "active_support/log_subscriber"
module ActionMailer
class LogSubscriber < ActiveSupport::EventReporter::LogSubscriber # :nodoc:
self.namespace = "action_mailer"
# An email was delivered.
def delivered(event)
payload = event[:payload]
info do
if ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/collector.rb | actionmailer/lib/action_mailer/collector.rb | # frozen_string_literal: true
require "abstract_controller/collector"
require "active_support/core_ext/hash/reverse_merge"
require "active_support/core_ext/array/extract_options"
module ActionMailer
class Collector
include AbstractController::Collector
attr_reader :responses
def initialize(context, &bl... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/mail_delivery_job.rb | actionmailer/lib/action_mailer/mail_delivery_job.rb | # frozen_string_literal: true
require "active_job"
module ActionMailer
# = Action Mailer \MailDeliveryJob
#
# The +ActionMailer::MailDeliveryJob+ class is used when you
# want to send emails outside of the request-response cycle. It supports
# sending either parameterized or normal mail.
#
# Exceptions ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/preview.rb | actionmailer/lib/action_mailer/preview.rb | # frozen_string_literal: true
require "active_support/descendants_tracker"
module ActionMailer
module Previews # :nodoc:
extend ActiveSupport::Concern
included do
# Add the location of mailer previews through app configuration:
#
# config.action_mailer.preview_paths << "#{Rails.root}/... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/message_delivery.rb | actionmailer/lib/action_mailer/message_delivery.rb | # frozen_string_literal: true
require "delegate"
module ActionMailer
class << self
# Enqueue many emails at once to be delivered through Active Job.
# When the individual job runs, it will send the email using +deliver_now+.
def deliver_all_later(*deliveries, **options)
_deliver_all_later("deliver... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/callbacks.rb | actionmailer/lib/action_mailer/callbacks.rb | # frozen_string_literal: true
module ActionMailer
module Callbacks
extend ActiveSupport::Concern
DEFAULT_INTERNAL_METHODS = [:_run_deliver_callbacks].freeze # :nodoc:
included do
include ActiveSupport::Callbacks
define_callbacks :deliver, skip_after_callbacks_if_terminated: true
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/delivery_methods.rb | actionmailer/lib/action_mailer/delivery_methods.rb | # frozen_string_literal: true
require "tmpdir"
module ActionMailer
# = Action Mailer \DeliveryMethods
#
# This module handles everything related to mail delivery, from registering
# new delivery methods to configuring the mail object to be sent.
module DeliveryMethods
extend ActiveSupport::Concern
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/structured_event_subscriber.rb | actionmailer/lib/action_mailer/structured_event_subscriber.rb | # frozen_string_literal: true
require "active_support/structured_event_subscriber"
module ActionMailer
class StructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber # :nodoc:
# An email was delivered.
def deliver(event)
exception = event.payload[:exception_object]
payload = {
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/railtie.rb | actionmailer/lib/action_mailer/railtie.rb | # frozen_string_literal: true
require "rails"
require "active_job/railtie"
require "action_mailer"
require "abstract_controller/railties/routes_helpers"
module ActionMailer
class Railtie < Rails::Railtie # :nodoc:
config.action_mailer = ActiveSupport::OrderedOptions.new
config.action_mailer.preview_paths = ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/parameterized.rb | actionmailer/lib/action_mailer/parameterized.rb | # frozen_string_literal: true
module ActionMailer
# = Action Mailer \Parameterized
#
# Provides the option to parameterize mailers in order to share instance variable
# setup, processing, and common headers.
#
# Consider this example that does not use parameterization:
#
# class InvitationsMailer < A... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/base.rb | actionmailer/lib/action_mailer/base.rb | # frozen_string_literal: true
require "mail"
require "action_mailer/collector"
require "active_support/core_ext/string/inflections"
require "active_support/core_ext/hash/except"
require "active_support/core_ext/module/anonymous"
require "action_mailer/log_subscriber"
require "action_mailer/structured_event_subscriber... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/test_helper.rb | actionmailer/lib/action_mailer/test_helper.rb | # frozen_string_literal: true
require "active_support/core_ext/array/extract_options"
require "active_job"
module ActionMailer
# Provides helper methods for testing Action Mailer, including #assert_emails
# and #assert_no_emails.
module TestHelper
include ActiveJob::TestHelper
# Asserts that the number... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/form_builder.rb | actionmailer/lib/action_mailer/form_builder.rb | # frozen_string_literal: true
module ActionMailer
# = Action Mailer Form Builder
#
# Override the default form builder for all views rendered by this
# mailer and any of its descendants. Accepts a subclass of
# ActionView::Helpers::FormBuilder.
#
# While emails typically will not include forms, this can ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/inline_preview_interceptor.rb | actionmailer/lib/action_mailer/inline_preview_interceptor.rb | # frozen_string_literal: true
require "base64"
module ActionMailer
# = Action Mailer \InlinePreviewInterceptor
#
# Implements a mailer preview interceptor that converts image tag src attributes
# that use inline +cid:+ style URLs to +data:+ style URLs so that they are visible
# when previewing an HTML email... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/deprecator.rb | actionmailer/lib/action_mailer/deprecator.rb | # frozen_string_literal: true
module ActionMailer
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/actionmailer/lib/action_mailer/mail_helper.rb | actionmailer/lib/action_mailer/mail_helper.rb | # frozen_string_literal: true
module ActionMailer
# = Action Mailer \MailHelper
#
# Provides helper methods for ActionMailer::Base that can be used for easily
# formatting messages, accessing mailer or message instances, and the
# attachments list.
module MailHelper
# Take the text and format it, inden... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionmailer/lib/action_mailer/gem_version.rb | actionmailer/lib/action_mailer/gem_version.rb | # frozen_string_literal: true
module ActionMailer
# Returns the currently loaded version of Action Mailer 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].comp... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/logger_test.rb | activesupport/test/logger_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require_relative "multibyte_test_helpers"
require "stringio"
require "fileutils"
require "tempfile"
require "tmpdir"
require "concurrent/atomics"
class LoggerTest < ActiveSupport::TestCase
include MultibyteTestHelpers
Logger = ActiveSupport::Logger
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/message_verifier_test.rb | activesupport/test/message_verifier_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "openssl"
require "active_support/time"
require "active_support/json"
require "active_support/core_ext/securerandom"
require_relative "messages/message_codec_tests"
class MessageVerifierTest < ActiveSupport::TestCase
include MessageCodecTests
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/digest_test.rb | activesupport/test/digest_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "openssl"
class DigestTest < ActiveSupport::TestCase
class InvalidDigest; end
def test_with_default_hash_digest_class
assert_equal OpenSSL::Digest::MD5.hexdigest("hello friend"), ActiveSupport::Digest.hexdigest("hello friend")
end
def... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/time_zone_test_helpers.rb | activesupport/test/time_zone_test_helpers.rb | # frozen_string_literal: true
module TimeZoneTestHelpers
def with_tz_default(tz = nil)
old_tz = Time.zone
Time.zone = tz
yield
ensure
Time.zone = old_tz
end
def with_env_tz(new_tz = "US/Eastern")
old_tz, ENV["TZ"] = ENV["TZ"], new_tz
yield
ensure
old_tz ? ENV["TZ"] = old_tz : ENV... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/silence_logger_test.rb | activesupport/test/silence_logger_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/logger_silence"
require "logger"
class LoggerSilenceTest < ActiveSupport::TestCase
class MyLogger < ::Logger
include ActiveSupport::LoggerSilence
end
setup do
@io = StringIO.new
@logger = MyLogger.new(@io)
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/structured_event_subscriber_test.rb | activesupport/test/structured_event_subscriber_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/testing/event_reporter_assertions"
class StructuredEventSubscriberTest < ActiveSupport::TestCase
include ActiveSupport::Testing::EventReporterAssertions
class TestEventReporterSubscriber
def emit(payload)
end
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/time_travel_test.rb | activesupport/test/time_travel_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/core_ext/date_time"
require "active_support/core_ext/numeric/time"
require "active_support/core_ext/string/conversions"
require_relative "time_zone_test_helpers"
class TimeTravelTest < ActiveSupport::TestCase
include TimeZoneTest... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/clean_logger_test.rb | activesupport/test/clean_logger_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "stringio"
require "active_support/logger"
class CleanLoggerTest < ActiveSupport::TestCase
def setup
@out = StringIO.new
@logger = ActiveSupport::Logger.new(@out)
end
def test_format_message
@logger.error "error"
assert_equa... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/log_subscriber_test.rb | activesupport/test/log_subscriber_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/log_subscriber/test_helper"
class SyncLogSubscriberTest < ActiveSupport::TestCase
include ActiveSupport::LogSubscriber::TestHelper
class MyLogSubscriber < ActiveSupport::LogSubscriber
attr_reader :event
def some_event... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/file_update_checker_test.rb | activesupport/test/file_update_checker_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require_relative "file_update_checker_shared_tests"
class FileUpdateCheckerTest < ActiveSupport::TestCase
include FileUpdateCheckerSharedTests
def new_checker(files = [], dirs = {}, &block)
ActiveSupport::FileUpdateChecker.new(files, dirs, &block... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/hash_with_indifferent_access_test.rb | activesupport/test/hash_with_indifferent_access_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "bigdecimal"
require "yaml"
require "active_support/core_ext/hash"
require "active_support/core_ext/string/access"
require "active_support/core_ext/object/conversions"
require "active_support/core_ext/object/deep_dup"
require "active_support/inflec... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/constantize_test_helpers.rb | activesupport/test/constantize_test_helpers.rb | # frozen_string_literal: true
module ConstantizeTestHelpers
ROOT_DIR = File.realpath("#{__dir__}/autoloading_fixtures")
AUTOLOADS = {
"RaisesLoadError" => "#{ROOT_DIR}/raises_load_error",
"RaisesNameError" => "#{ROOT_DIR}/raises_name_error",
"RaisesNoMethodError" => "#{ROOT_DIR}/raises_no_meth... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/dependencies_test.rb | activesupport/test/dependencies_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/dependencies"
module ModuleWithMissing
mattr_accessor :missing_count
def self.const_missing(name)
self.missing_count += 1
name
end
end
module ModuleWithConstant
InheritedConstant = "Hello"
end
class RequireDepende... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/evented_file_update_checker_test.rb | activesupport/test/evented_file_update_checker_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "pathname"
require "weakref"
require_relative "file_update_checker_shared_tests"
class EventedFileUpdateCheckerTest < ActiveSupport::TestCase
include FileUpdateCheckerSharedTests
def setup
skip if ENV["LISTEN"] == "0"
require "listen"... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/rescuable_test.rb | activesupport/test/rescuable_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class WraithAttack < StandardError
end
class MadRonon < StandardError
end
class CoolError < StandardError
end
module WeirdError
def self.===(other)
Exception === other && other.respond_to?(:weird?)
end
end
class Stargate
# Nest this so the '... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/number_helper_test.rb | activesupport/test/number_helper_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/number_helper"
require "active_support/core_ext/string/output_safety"
module ActiveSupport
module NumberHelper
class NumberHelperTest < ActiveSupport::TestCase
class TestClassWithInstanceNumberHelpers
include Ac... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/gzip_test.rb | activesupport/test/gzip_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/core_ext/object/blank"
class GzipTest < ActiveSupport::TestCase
def test_compress_should_decompress_to_the_same_value
assert_equal "Hello World", ActiveSupport::Gzip.decompress(ActiveSupport::Gzip.compress("Hello World"))
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/current_attributes_test.rb | activesupport/test/current_attributes_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/current_attributes/test_helper"
class CurrentAttributesTest < ActiveSupport::TestCase
# CurrentAttributes is automatically reset in Rails app via executor hooks set in railtie
# But not in Active Support's own test suite.
inc... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/ordered_options_test.rb | activesupport/test/ordered_options_test.rb | # frozen_string_literal: true
require "pp"
require_relative "abstract_unit"
require "active_support/ordered_options"
class OrderedOptionsTest < ActiveSupport::TestCase
def test_usage
a = ActiveSupport::OrderedOptions.new
assert_nil a[:not_set]
a[:allow_concurrency] = true
assert_equal 1, a.size
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/option_merger_test.rb | activesupport/test/option_merger_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/core_ext/object/with_options"
class OptionMergerTest < ActiveSupport::TestCase
def setup
@options = { hello: "world" }
end
def test_method_with_options_merges_string_options
local_options = { "cool" => true }
wi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/parameter_filter_test.rb | activesupport/test/parameter_filter_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/core_ext/hash"
require "active_support/parameter_filter"
class ParameterFilterTest < ActiveSupport::TestCase
test "process parameter filter" do
test_hashes = [
[{ "foo" => "bar" }, { "foo" => "bar" }, %w'food'],
[{ "f... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/descendants_tracker_test.rb | activesupport/test/descendants_tracker_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/descendants_tracker"
class DescendantsTrackerTest < ActiveSupport::TestCase
setup do
if ActiveSupport::DescendantsTracker.class_variable_defined?(:@@direct_descendants)
@original_state = ActiveSupport::DescendantsTracke... | 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.