From 1d0b9f17ef28ba622a4dcb04672b45b4846e31f5 Mon Sep 17 00:00:00 2001 From: Santiago Diaz Date: Wed, 4 Oct 2023 13:04:27 -0300 Subject: [PATCH] Fix spec --- lib/active_outbox/outboxable.rb | 1 - spec/lib/active_outbox/outboxable_spec.rb | 21 +++++++++------------ spec/support/00_outbox_config.rb | 1 - 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lib/active_outbox/outboxable.rb b/lib/active_outbox/outboxable.rb index 7b6212f..16e79d9 100644 --- a/lib/active_outbox/outboxable.rb +++ b/lib/active_outbox/outboxable.rb @@ -75,7 +75,6 @@ def namespace_outbox_mapping end def default_outbox_mapping - # byebug ActiveOutbox.configuration.outbox_mapping['default'] end diff --git a/spec/lib/active_outbox/outboxable_spec.rb b/spec/lib/active_outbox/outboxable_spec.rb index 97ef978..e51daa6 100644 --- a/spec/lib/active_outbox/outboxable_spec.rb +++ b/spec/lib/active_outbox/outboxable_spec.rb @@ -57,6 +57,15 @@ subject(:save_instance) { fake_model_instance.save } context 'when record is created' do + context 'when the ActiveOutbox configuration is not set' do + before do + allow(ActiveOutbox.configuration).to receive(:outbox_mapping).and_return({ 'default' => nil }) + end + + include_examples 'raises an error and does not create neither the record nor the outbox record', + ActiveOutbox::OutboxClassNotFoundError + end + context 'when outbox record is created' do let(:event) { 'FAKE_MODEL_CREATED' } @@ -108,18 +117,6 @@ include_examples 'raises an error and does not create neither the record nor the outbox record', ActiveRecord::RecordNotSaved end - - context 'when the ActiveOutbox configuration is not set' do - before do - # active_outbox = instance_double(ActiveOutbox) - # allow(ActiveOutbox).to receive(:new).and_return(active_outbox) - # byebug - allow(ActiveOutbox.configuration).to receive(:outbox_mapping).and_return({ 'default' => nil }) - end - - include_examples 'raises an error and does not create neither the record nor the outbox record', - ActiveOutbox::OutboxClassNotFoundError - end end context 'when the record could not be created' do diff --git a/spec/support/00_outbox_config.rb b/spec/support/00_outbox_config.rb index de1cf4e..142a043 100644 --- a/spec/support/00_outbox_config.rb +++ b/spec/support/00_outbox_config.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true ActiveOutbox.configure do |config| - # byebug config.outbox_mapping.merge!( 'default' => 'Outbox' )