1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionmailer/test/mailers/delayed_mailer.rb

33 lines
839 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require "active_job/arguments"
class DelayedMailerError < StandardError; end
2014-08-12 14:24:19 -04:00
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
2014-08-12 14:24:19 -04:00
def test_message(*)
mail(from: "test-sender@test.com", to: "test-receiver@test.com", subject: "Test Subject", body: "Test Body")
2014-08-12 14:24:19 -04:00
end
def test_kwargs(argument:)
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
2014-08-12 14:24:19 -04:00
end