Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Testing and inline non-mutually exclusive #1053

Closed
ilyakatz opened this Issue Jul 12, 2013 · 5 comments

Comments

4 participants

According to this doc https://github.com/mperham/sidekiq/wiki/Testing

require 'sidekiq/testing/inline'

and

require 'sidekiq/testing'

are mutually exclusive, which means that one test suite cannot verify that jobs are queuing up correctly and that they are doing correct things. I think that should not be the case. I've seen somewhere mentions to Resque.inline which can be flipped on and off as needed. I believe that would be a better way.

@ilyakatz Using the inline approach just makes jobs be executed immediately instead of relying on calling .drain.

Personally I've been using the fancy rspec matchers from rspec-sidekiq to test enqueuing behaviours and just test the .perform on workers as normal Ruby objects.

Owner

mperham commented Jul 20, 2013

Normally you should unit test your workers and you should unit test your code which creates jobs, using the normal sidekiq/testing support. We don't use inline at all fwiw.

I could see a case for using inline in integration tests but I despise setting a global variable, I'd much prefer a block form like so:

around(:each) do |block|
  Sidekiq.inline(&block)
end
Collaborator

ryansch commented Aug 15, 2013

I'd love to see a solution like that for our acceptance tests.

Owner

mperham commented Sep 21, 2013

Just merged, thanks @ryansch!

@mperham mperham closed this Sep 21, 2013

ilyakatz commented Nov 5, 2013

thanks @ryansch @mperham, just picked up the new version with updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment