I personally check my employees different. I use RSpec and, for example, in my user model, I am testing something like this:
it "enqueue FooWorker#create_user" do mock(Resque).enqueue(FooWorker, :create_user, user.id) user.create_on_foo end
Then I have a file called spec / workers / foo_worker_spec.rb with the following contents:
require 'spec_helper' describe FooWorker do describe "#perform" do it "redirects to passed action" do ... FooWorker.perform ... end end end
Then your model / controller tests run faster and you have no dependency between the model / controller and your worker in your tests. You also should not scoff at things that are not related to the employee.
But if you donβt do it, as you mentioned, it worked for me several times ago. I put Resque.inline = true in the configuration of the test environment.
Daniel Spangenberg
source share