-
Notifications
You must be signed in to change notification settings - Fork 22k
Closed
Description
related to #55448
Steps to reproduce
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
# gem "rails", github: 'rails/rails'
# If you want to test against edge Rails replace the previous line with this:
gem "rails", github: "rails/rails", branch: "main"
gem "net-smtp", github: "ruby/net-smtp", ref: "d496a829f9b99adb44ecc1768c4d005e5f7b779e", require: false
end
require "action_mailer/railtie"
require "minitest/autorun"
class TestApp < Rails::Application
config.load_defaults Rails::VERSION::STRING.to_f
config.root = __dir__
config.eager_load = false
config.hosts << "example.org"
config.secret_key_base = "secret_key_base"
config.logger = Logger.new($stdout)
end
Rails.application.initialize!
$should_not_be_run = false
class TestMailer < ActionMailer::Base
attr_accessor :should_not_be_run
def hello_world
@message = "Hello, world"
$should_not_be_run = true
mail from: "test@example.com", to: "user@example.com" do |format|
format.html { render inline: "<h1><%= @message %></h1>" }
format.text { render inline: "<%= @message %>" }
end
end
end
class BugTest < ActionMailer::TestCase
test "Does not run hello_world when calling deliver_all_later" do
email = TestMailer.hello_world
ActionMailer.deliver_all_later([email])
assert_not $should_not_be_run
end
end
Expected behavior
When I can ActionMailer.deliver_all_later([mailer1, mailer2])
it should not process and execute the mailer
Actual behavior
- mailers are called
- mailers are enqueued through the job adapter
So double processing : Inline ( similar to deliver_now
) and "later" by enqueuing in the job adapter
System configuration
Rails version: main aedfc4af7625312bfdec087a0d03e5ad5da80027
Ruby version: 3.4.5
Metadata
Metadata
Assignees
Labels
No labels