require 'test_helper' describe Fanforce::Worker do before do clean_dbs end it 'should enqueue a job' do Fanforce::Worker.enqueue('test', {name: 'caleb'}) assert Fanforce::Worker.iron_mq.queue('test').size == 1 end it 'should run an enqueued job' do Fanforce::Worker.enqueue('test', {name: 'caleb'}) processed_job = false Fanforce::Worker.run({'queue_id' => 'test'}) do |params| processed_job = true assert params[:name] == 'caleb' end assert processed_job == true assert Fanforce::Worker.iron_mq.queue('test').size == 0 end end