diff --git a/config/environments/test.rb b/config/environments/test.rb index b2f86f2e..3977e2c0 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -44,6 +44,7 @@ Rails.application.configure do # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test + config.active_job.queue_adapter = :test # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index dd87f1f1..49d72854 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -47,6 +47,7 @@ RSpec.configure do |config| config.include FactoryBot::Syntax::Methods config.include Devise::Test::IntegrationHelpers + config.include ActiveJob::TestHelper config.before(:each, type: :system) do if ENV['HEADLESS'] == 'false' diff --git a/spec/system/submit_form_spec.rb b/spec/system/submit_form_spec.rb index b9b44d19..37504aca 100644 --- a/spec/system/submit_form_spec.rb +++ b/spec/system/submit_form_spec.rb @@ -81,15 +81,7 @@ RSpec.describe 'Submit Form' do expect do click_on 'Submit' - end.to change { ActionMailer::Base.deliveries.size }.by(1) - - email = ActionMailer::Base.deliveries.last - - expect(email.subject).to eq("#{submitter.email} has completed the \"#{template.name}\" form") - - expect(email.body.encoded).to include "Hi #{user.first_name}," - expect(email.body.encoded).to include "#{submitter.email} has completed the \"#{template.name}\" form." - expect(email.body.encoded).to have_link('View Submission') + end.to change(enqueued_jobs, :size).by(3) end end end