Sha256: 9e49ef71e1cc7f38f88960a7b647dd396baec341608dc5551850fa94d9919aa7
Contents?: true
Size: 1.61 KB
Versions: 108
Compression:
Stored size: 1.61 KB
Contents
require 'spec_helper' RSpec.describe CanvasSync::JobBatches::Batch::Callback.worker_class 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
108 entries across 108 versions & 1 rubygems