Sha256: 9b87191133034bcd0eabea5ba2a34140096686e7d678846471a9b0140d49f5cf
Contents?: true
Size: 1.61 KB
Versions: 18
Compression:
Stored size: 1.61 KB
Contents
require 'spec_helper' RSpec.describe CanvasSync::JobBatches::Batch::Callback::Worker do describe '#perform' do it 'does not do anything if it cannot find the callback class' do subject.perform('SampleCallback', 'complete', {}, 'ABCD', 'EFGH') end it 'does not do anything if event is different from complete or success' do expect(SampleCallback).not_to receive(:new) subject.perform('SampleCallback', 'ups', {}, 'ABCD', 'EFGH') end it 'calls on_success if defined' do callback_instance = double('SampleCallback', on_success: true) expect(SampleCallback).to receive(:new).and_return(callback_instance) expect(callback_instance).to receive(:on_success) .with(instance_of(CanvasSync::JobBatches::Batch::Status), {}) subject.perform('SampleCallback', 'success', {}, 'ABCD', 'EFGH') end it 'calls on_complete if defined' do callback_instance = double('SampleCallback') expect(SampleCallback).to receive(:new).and_return(callback_instance) expect(callback_instance).to receive(:on_complete) .with(instance_of(CanvasSync::JobBatches::Batch::Status), {}) subject.perform('SampleCallback', 'complete', {}, 'ABCD', 'EFGH') end it 'calls specific callback if defined' do callback_instance = double('SampleCallback') expect(SampleCallback).to receive(:new).and_return(callback_instance) expect(callback_instance).to receive(:sample_method) .with(instance_of(CanvasSync::JobBatches::Batch::Status), {}) subject.perform('SampleCallback#sample_method', 'complete', {}, 'ABCD', 'EFGH') end end end
Version data entries
18 entries across 18 versions & 1 rubygems