rubocop / rubocop-rspec

Code style checking for RSpec files.
https://docs.rubocop.org/rubocop-rspec
MIT License
804 stars 277 forks source link

Cop idea: Replace ActiveJob::TestHelper with activejob matchers #334

Open Darhazer opened 7 years ago

Darhazer commented 7 years ago

I'm working on a code base that tests ActiveJobs with assert_enqued_job, assert_enqueued_with, etc, included by the ActiveJob::TestHelper, which is written with minitest. rpsec-rails however provide have_enqueued_job matcher

backus commented 7 years ago

I'm open to PRs for this. I have mentioned this in other PRs but I don't plan on implementing rails specific cops. It would also be nice if these things checked if rails cops were enabled

Darhazer commented 7 years ago

@backus what about capybara-specific checks? I've ran in some wrong usages of capybara matchers

backus commented 7 years ago

As long as capybara support don't get in the way of normal rspec users I guess I'm fine with it. I don't use capybara so I wont be great as a primary reviewer for these.

Darhazer commented 3 years ago

I also seen specs like expect(ActionMailer::MailDeliveryJob).to have_been_enqueued.with(Mailer, :something, :deliver_now) instead of using enqueued_mail matcher

pirj commented 3 years ago

Did that spec fail, @Darhazer ?

Darhazer commented 3 years ago

Nope, but it's overly expressive and leaks internals :)