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

Cop Idea: Avoid allow Worker to receive(:perform_) #1646

Closed
HarlemSquirrel opened this issue May 10, 2023 · 1 comment
Closed

Cop Idea: Avoid allow Worker to receive(:perform_) #1646

HarlemSquirrel opened this issue May 10, 2023 · 1 comment

Comments

@HarlemSquirrel
Copy link

Stubbing calls to enqueue workers can miss calls that use bad arguments such as those that do not serialize to JSON with Sidekiq 7.

Bad

allow(SomeWorker).to receive(:perform_async)
allow(SomeWorker).to receive(:perform_in)

Good

Sidekiq::Testing.fake!
@pirj
Copy link
Member

pirj commented May 10, 2023

I'm uncertain if we plan to include cops that would cover other, even very popular, libraries.
We've recently extracted capybara and factory_bot and plan to extract rspec-rails, as there are plenty of issues specific to the plain RSpec usage.

The idea for such an extension was brought up already, and there's even a rubocop-sidekiq repository.
Please do not get me wrong, I completely support your idea. I suggest sending a PR there.
You may also send a PR to the style guide, I'll gladly accept it.

Thanks for bringing this up!

@pirj pirj closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants