Open wahlg opened 1 year ago
this API needs to be expanded in karafka-testing:
https://github.com/rspec/rspec-rails/blob/main/lib/rspec/rails/matchers/active_job.rb#L233
moving there
sorry I forgot about this one. Checking now :pray:
@wahlg when I try to do what you did I am getting:
To use ActiveJob matchers set `ActiveJob::Base.queue_adapter = :test`
any chance you could use this example repo to create a repro? https://github.com/karafka/example-apps/tree/master/v2.1-rails
If you configure a Rails application to use the karafka queue adapter as described in https://karafka.io/docs/Active-Job/, then when writing rspec tests that use the have_enqueued_job matcher, they will fail reporting no jobs were enqueued
Expected behavior
When configuring rails to use the karafka ActiveJob adapter with:
Then if I write ruby code to publish a job:
I expect an rspec test like this to pass:
Actual behavior
The rspec test fails with
I also observed this happens regardless of whether I use the produce_sync option or not
Steps to reproduce the problem
Create a rails 7 application, and configure it to use the :karafka queue adapter for ActiveJob as per above
Set up the karafka gem
Write a test that enqueues a job
See that it fails to report enqueueing the job
Your setup details
I am using Rails 7.0.4.3 and rspec 3.12.0
Karafka info is below: