-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Update method name in HaveEnqueuedMail (job_match? to job_matches?) #2793
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,10 @@ class AnotherTestMailer < ActionMailer::Base | |
def test_email; end | ||
end | ||
|
||
class NonMailerJob < ActiveJob::Base | ||
def perform; end | ||
end | ||
|
||
if RSpec::Rails::FeatureCheck.has_action_mailer_unified_delivery? | ||
class UnifiedMailer < ActionMailer::Base | ||
self.delivery_job = ActionMailer::MailDeliveryJob | ||
|
@@ -95,6 +99,10 @@ def test_email; end | |
expect { }.not_to have_enqueued_email | ||
end | ||
|
||
it "passes when negated with 0 arguments and a non-mailer job is enqueued" do | ||
expect { NonMailerJob.perform_later }.not_to have_enqueued_email | ||
end | ||
|
||
it "passes when only given mailer argument" do | ||
expect { | ||
TestMailer.test_email.deliver_later | ||
|
@@ -305,11 +313,6 @@ def test_email; end | |
end | ||
|
||
it "generates a failure message with unmatching enqueued mail jobs" do | ||
non_mailer_job = Class.new(ActiveJob::Base) do | ||
def perform; end | ||
def self.name; "NonMailerJob"; end | ||
end | ||
Comment on lines
-308
to
-311
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Since now there are two specs in this file (i.e. the spec being modified here, and the new spec that I added above) that have occasion to refer to a non-mailer job class, I am extracting this previously anonymous/local job class up to an actual class constant defined in the setup at the top of this file. The downside of this is that the global Ruby namespace in specs is now polluted by an additional constant, |
||
|
||
send_time = Date.tomorrow.noon | ||
queue = 'urgent_mail' | ||
|
||
|
@@ -320,7 +323,7 @@ def self.name; "NonMailerJob"; end | |
|
||
expect { | ||
expect { | ||
non_mailer_job.perform_later | ||
NonMailerJob.perform_later | ||
TestMailer.test_email.deliver_later | ||
TestMailer.email_with_args(3, 4).deliver_later(wait_until: send_time, queue: queue) | ||
}.to have_enqueued_email(TestMailer, :email_with_args).with(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 new spec fails without the
job_match?
=>job_matches?
rename done in this PR.)