Sha256: aee8b1712d039d6c4436157d86e6311507ad0a08476aaa501672aae54ff54b6e
Contents?: true
Size: 992 Bytes
Versions: 7
Compression:
Stored size: 992 Bytes
Contents
require 'spec_helper' module AsyncRequest describe JobProcessor do include AsyncRequest::Engine.helpers describe '.perform' do let(:uid) { execute_async(Test, { a: 'a' }, 3, 'a') } before(:each) do Test.any_instance.stub(:execute).and_return([200, { status: 'success' }]) end context 'When executing the worker' do it 'calls Test class' do expect_any_instance_of(Test).to receive(:execute).with({ a: 'a' }, 3, 'a') JobProcessor.new.perform(Job.find_by(uid: uid).id) end it 'saves the worker status code' do JobProcessor.new.perform(Job.find_by(uid: uid).id) expect(Job.find_by(uid: uid).status_code).to eq 200 end it 'saves the worker response' do JobProcessor.new.perform(Job.find_by(uid: uid).id) response = Job.find_by(uid: uid).response expect(response).to eq({ status: 'success' }.to_json) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems