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:
lib/action_mailer/test_case.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

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

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 '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