Skip to content
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

How to expect to have_enqueued_sidekiq_job with specific queue? - [setting queue name at runtime] #184

Closed
RichardsonWTR opened this issue Apr 20, 2022 · 1 comment · Fixed by #197
Milestone

Comments

@RichardsonWTR
Copy link

My class decides the queue name dynamically depending on business rules.

How to expect that my class has enqueued the specific job with the specific arguments in the specific queue?

One way to to this could be with this API

expect(AwesomeJob).to have_enqueued_sidekiq_job('Awesome', true).at(time).on('my_queue')

Why ?

Because my code is enqueuing the job in a command like this one:

AwesomeJob.set(queue: queue_name).perform_async('Awesome', true)

One way to accomplish this

One way that I've found to accomplish this is (But I don't think its elegant):

expect(AwesomeJob.jobs.last['queue']).to eq 'my_queue'
@wspurgin
Copy link
Owner

Heyo 👋 This repo was in a bit of limbo for the last year or two. I think this is a nice feature to add. I like the on syntax. Someone made an attempt a few years back in #164 with to but it needs revisiting. I'll look into add this to the v4 milestone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants