-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Improve mailer argument deserialisation for 6.1 on Ruby 3.1 #2566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
def ruby_3_1? | ||
RUBY_VERSION >= "3.1" | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want this it should be in RSpec Support, its a later improvement that could be made once 3.11 is released.
}.to have_enqueued_mail(UnifiedMailer, :email_with_args).with({'foo' => 'bar'}, 1, 2) | ||
}.to have_enqueued_mail(UnifiedMailer, :email_with_args).with( | ||
a_hash_including(params: {'foo' => 'bar'}, args: [1, 2]) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just unpicks the changes to the behaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if both:
have_enqueued_mail(UnifiedMailer, :email_with_args).with(
a_hash_including(params: {'foo' => 'bar'}, args: [1, 2])
)
and
have_enqueued_mail(UnifiedMailer, :email_with_args).with({'foo' => 'bar'}, 1, 2)
would match.
I was believing that the change from #2516 made both match, but it's not confirmed in specs.
84f4b30
to
b427c6e
Compare
b427c6e
to
d9dc770
Compare
Improve mailer argument deserialisation for 6.1 on Ruby 3.1
I really like how you've structured the code here. |
@pirj this is a simpler version of the changes required to fix mailers solely on Ruby 3.1 for Rails 6.1
The problem was not the different mailers but simply that Rails changed (only on 6.1) how it deserialized arguments, this logic restores that original implementation for our matcher and is the change I want to ship in the next 5.0 and 5.1 releases.
Arguably this could be in the jobs matcher and I'm surprised our specs pass as is for the jobs matcher, but its probably because that has less explicit requirements around deserialising.
I'm going to merge this to 5-1-maintenance and cherry pick to 5-0-maintenance on green, so you don't have to worry about that.