Sha256: 693425d3f705a2d59a6742879e5be44970cdef567571f8341847325b3a05c590
Contents?: true
Size: 1.07 KB
Versions: 10
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe SolidusBolt::Sorter do subject(:do_call) { described_class.call(params) } let(:event_type) { 'EVENT.TYPE' } let(:params) { { type: event_type, resource: {} } } it { expect(described_class).to respond_to(:new).with(1).arguments } it { expect(described_class).to respond_to(:call).with(1).arguments } it { expect(described_class.new({})).to respond_to(:call).with(0).arguments } describe '#call' do context 'when the handler is not defined' do it 'returns nil' do expect(do_call).to be_nil end end context 'when the handler is defined' do let(:result) { 'result' } let(:event_type) { 'BASE' } let(:handler) { instance_double(SolidusBolt::Handlers::BaseHandler) } before do allow(SolidusBolt::Handlers::BaseHandler).to receive(:new).and_return(handler) allow(handler).to receive(:call).and_return(result) end it { expect { do_call }.not_to raise_exception } it { expect(do_call).to be result } end end end
Version data entries
10 entries across 10 versions & 1 rubygems