Inside of my User model I'm calling a delayed method:
class User < ActiveRecord::Base
def self.import_items
...
User.delay.keep_only_user_cars(1) # "1" is just for testing
end
end
And I'm trying to test it like so (using rspec-sidekiq gem):
expect(Sidekiq::Extensions::DelayedClass).to have_enqueued_job("keep_only_user_cars", 1)
This is what I get:
Failure/Error: expect(Sidekiq::Extensions::DelayedClass).to have_enqueued_job("keep_only_user_cars", 1)
expected to have an enqueued Sidekiq::Extensions::DelayedClass job with arguments ["keep_only_user_cars", 1] but none found
found: [["---\n- !ruby/class 'User'\n- :keep_only_user_cars\n- - 1\n"]]
Which basically works, just has a bit different formatting.
How do I fix this test to make sure that Sidekiq received exactly this method with exactly this attribute?