module ActionMailer::TestCase::Behavior - actionmailer-4.2.4 Documentation

# module ActionMailer::TestCase::Behavior

### Protected Instance Methods

initialize_test_deliveries() click to toggle source

    # File lib/action_mailer/test_case.rb, line 60
    def initialize_test_deliveries
      set_delivery_method :test
      @old_perform_deliveries = ActionMailer::Base.perform_deliveries
      ActionMailer::Base.perform_deliveries = true
    end

restore_delivery_method() click to toggle source

    # File lib/action_mailer/test_case.rb, line 77
    def restore_delivery_method
      ActionMailer::Base.delivery_method = @old_delivery_method
    end

restore_test_deliveries() click to toggle source

    # File lib/action_mailer/test_case.rb, line 66
    def restore_test_deliveries
      restore_delivery_method
      ActionMailer::Base.perform_deliveries = @old_perform_deliveries
      ActionMailer::Base.deliveries.clear
    end

set_delivery_method(method) click to toggle source

    # File lib/action_mailer/test_case.rb, line 72
    def set_delivery_method(method)
      @old_delivery_method = ActionMailer::Base.delivery_method
      ActionMailer::Base.delivery_method = method
    end

set_expected_mail() click to toggle source

    # File lib/action_mailer/test_case.rb, line 81
    def set_expected_mail
      @expected = Mail.new
      @expected.content_type ["text", "plain", { "charset" => charset }]
      @expected.mime_version = '1.0'
    end

### Private Instance Methods

charset() click to toggle source

    # File lib/action_mailer/test_case.rb, line 89
    def charset
      "UTF-8"
    end

encode(subject) click to toggle source

    # File lib/action_mailer/test_case.rb, line 93
    def encode(subject)
      Mail::Encodings.q_value_encode(subject, charset)
    end

read_fixture(action) click to toggle source

    # File lib/action_mailer/test_case.rb, line 97
    def read_fixture(action)
      IO.readlines(File.join(Rails.root, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
    end