rails/actionmailer/test/form_builder_test.rb
Alex Ghiculescu 9a2cf33f21
Introduce ActionMailer::FormBuilder
Fixes https://github.com/rails/rails/issues/48477

Using forms inside emails is not common, but it's possible, and it's also possible to share views between controllers and mailers. Currently if a controller sets a `default_form_builder` that's different from the global config, mailers that use the same views will not default to the same `FormBuilder`. To fix this, this PR adds a `default_form_builder` method for mailers that does the same thing as its controller sibling.
2023-09-25 20:33:22 +00:00

12 lines
311 B
Ruby

# 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