Skip to content

Commit

Permalink
Run jobs in test with the test adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
redsummernight committed Feb 6, 2025
1 parent 4062ed0 commit 6daa29a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test

# Run jobs with an in-process thread pool.
config.active_job.queue_adapter = :async
# Run jobs with a test queue that allows assertions on enqueued jobs.
config.active_job.queue_adapter = :test

# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
Expand Down
2 changes: 0 additions & 2 deletions spec/lib/tasks/notifications.rake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
let!(:user) { create(:user) }

it "enqueues one tos update notifications" do
ActiveJob::Base.queue_adapter = :test
expect(User.all.size).to eq(1)
expect { subject.invoke(admin_post.id) }
.to have_enqueued_mail(TosUpdateMailer, :tos_update_notification).on_queue(:tos_update).with(user, admin_post.id)
Expand All @@ -18,7 +17,6 @@
before { create_list(:user, 10) }

it "enqueues multiple tos update notifications" do
ActiveJob::Base.queue_adapter = :test
expect(User.all.size).to eq(10)
expect { subject.invoke(admin_post.id) }
.to have_enqueued_mail(TosUpdateMailer, :tos_update_notification).on_queue(:tos_update).with(instance_of(User), admin_post.id).exactly(10)
Expand Down

0 comments on commit 6daa29a

Please sign in to comment.