delayed_job_worker_spec.rb 634 B

12345678910111213141516171819202122232425262728
  1. require 'rails_helper'
  2. describe DelayedJobWorker do
  3. before do
  4. @djw = DelayedJobWorker.new
  5. end
  6. it "should run" do
  7. mock.instance_of(Delayed::Worker).start
  8. @djw.run
  9. end
  10. it "should stop" do
  11. mock.instance_of(Delayed::Worker).start
  12. mock.instance_of(Delayed::Worker).stop
  13. @djw.run
  14. @djw.stop
  15. end
  16. context "#setup_worker" do
  17. it "should return an array with an instance of itself" do
  18. workers = DelayedJobWorker.setup_worker
  19. expect(workers).to be_a(Array)
  20. expect(workers.first).to be_a(DelayedJobWorker)
  21. expect(workers.first.id).to eq('DelayedJobWorker')
  22. end
  23. end
  24. end