Module: ActionMailer::TestCase::Behavior

Extended by:
ActiveSupport::Concern
Includes:
ActionMailer::TestHelper, ActiveSupport::Testing::ConstantLookup, Rails::Dom::Testing::Assertions::DomAssertions, Rails::Dom::Testing::Assertions::SelectorAssertions
Included in:
ActionMailer::TestCase
Defined in:
actionmailer/lib/action_mailer/test_case.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary

Constants included from ActiveSupport::Testing::Assertions

ActiveSupport::Testing::Assertions::UNTRACKED

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

append_features, class_methods, extended, included, prepend_features, prepended

Methods included from ActionMailer::TestHelper

#assert_emails, #assert_enqueued_email_with, #assert_enqueued_emails, #assert_no_emails, #assert_no_enqueued_emails, #capture_emails, #deliver_enqueued_emails

Methods included from ActiveJob::TestHelper

#after_teardown, #assert_enqueued_jobs, #assert_enqueued_with, #assert_no_enqueued_jobs, #assert_no_performed_jobs, #assert_performed_jobs, #assert_performed_with, #before_setup, #perform_enqueued_jobs, #queue_adapter, #queue_adapter_for_test

Methods included from ActiveSupport::Testing::Assertions

#assert_changes, #assert_difference, #assert_no_changes, #assert_no_difference, #assert_not, #assert_nothing_raised, #assert_raises

Instance Method Details

#read_fixture(action) ⇒ Object

Reads the fixture file for the given mailer.

This is useful when testing mailers by being able to write the body of an email inside a fixture. See the testing guide for a concrete example: guides.rubyonrails.org/testing.html#revenge-of-the-fixtures



82
83
84
# File 'actionmailer/lib/action_mailer/test_case.rb', line 82

def read_fixture(action)
  IO.readlines(File.join(Rails.root, "test", "fixtures", self.class.mailer_class.name.underscore, action))
end