Sha256: 4bfbaef98f02a80ff62843e89d82711f0490826d1f14443d3ac794c393018734

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

require "active_job/arguments"

class DelayedMailerError < StandardError; end

class DelayedMailer < ActionMailer::Base
  cattr_accessor :last_error
  cattr_accessor :last_rescue_from_instance

  rescue_from DelayedMailerError do |error|
    @@last_error = error
    @@last_rescue_from_instance = self
  end

  rescue_from ActiveJob::DeserializationError do |error|
    @@last_error = error
    @@last_rescue_from_instance = self
  end

  def test_message(*)
    mail(from: "test-sender@test.com", to: "test-receiver@test.com", subject: "Test Subject", body: "Test Body")
  end

  def test_raise(klass_name)
    raise klass_name.constantize, "boom"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-on-quails-0.1.0 actionmailer/test/mailers/delayed_mailer.rb