X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/3b96bbc80976836c6783ddd81db2f93b7e3fa3a2..d5d92e60564dcd322a736c4bd3ddf831631d9c0e:/test/jobs/trace_importer_job_test.rb diff --git a/test/jobs/trace_importer_job_test.rb b/test/jobs/trace_importer_job_test.rb index 73c8cebbe..e1ddcc967 100644 --- a/test/jobs/trace_importer_job_test.rb +++ b/test/jobs/trace_importer_job_test.rb @@ -12,16 +12,14 @@ class TraceImporterJobTest < ActiveJob::TestCase end trace.stub(:import, gpx) do - perform_enqueued_jobs do - TraceImporterJob.perform_now(trace) - end + TraceImporterJob.perform_now(trace) end - assert_performed_jobs 1 - email = ActionMailer::Base.deliveries.last assert_equal trace.user.email, email.to[0] assert_match(/success/, email.subject) + + ActionMailer::Base.deliveries.clear end def test_failure_notification @@ -34,31 +32,27 @@ class TraceImporterJobTest < ActiveJob::TestCase end trace.stub(:import, gpx) do - perform_enqueued_jobs do - TraceImporterJob.perform_now(trace) - end + TraceImporterJob.perform_now(trace) end - assert_performed_jobs 1 - email = ActionMailer::Base.deliveries.last assert_equal trace.user.email, email.to[0] assert_match(/failure/, email.subject) + + ActionMailer::Base.deliveries.clear end def test_error_notification # Check that the user gets a failure notification when something goes badly wrong trace = create(:trace) trace.stub(:import, -> { raise }) do - perform_enqueued_jobs do - TraceImporterJob.perform_now(trace) - end + TraceImporterJob.perform_now(trace) end - assert_performed_jobs 1 - email = ActionMailer::Base.deliveries.last assert_equal trace.user.email, email.to[0] assert_match(/failure/, email.subject) + + ActionMailer::Base.deliveries.clear end end