Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rspec/rails/matchers/have_enqueued_mail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def deserialize_arguments(job)
if hash.key?("_aj_ruby2_keywords")
keywords = hash["_aj_ruby2_keywords"]

original_hash = keywords.each_with_object({}) { |new_hash, keyword| new_hash[keyword.to_sym] = hash[keyword] }
original_hash = keywords.each_with_object({}) { |keyword, new_hash| new_hash[keyword.to_sym] = hash[keyword] }

args + [original_hash]
elsif hash.key?(:args) && hash.key?(:params)
Expand Down
12 changes: 12 additions & 0 deletions spec/rspec/rails/matchers/have_enqueued_mail_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
require "action_mailer"
require "rspec/rails/matchers/have_enqueued_mail"

class GlobalIDArgument
include GlobalID::Identification
def id; 1; end
def to_global_id(options = {}); super(options.merge(app: 'rspec-rails')); end
end

class TestMailer < ActionMailer::Base
def test_email; end
def email_with_args(arg1, arg2); end
Expand Down Expand Up @@ -413,6 +419,12 @@ def self.name; "NonMailerJob"; end
)
end

it "passes when given a global id serialised argument" do
expect {
UnifiedMailer.with(inquiry: GlobalIDArgument.new).test_email.deliver_later
}.to have_enqueued_email(UnifiedMailer, :test_email)
end

it "passes when using a mailer with `delivery_job` set to a sub class of `ActionMailer::DeliveryJob`" do
expect {
UnifiedMailerWithDeliveryJobSubClass.test_email.deliver_later
Expand Down