diff --git a/lib/active_outbox/outboxable.rb b/lib/active_outbox/outboxable.rb index e1840d1..edeed26 100644 --- a/lib/active_outbox/outboxable.rb +++ b/lib/active_outbox/outboxable.rb @@ -74,11 +74,11 @@ def outbox_model_name_from_config def namespace_outbox_mapping namespace = self.class.name.split('/').first - ActiveOutbox.configuration.outbox_mapping[namespace&.underscore] 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 603c0a2..ea0eb54 100644 --- a/spec/lib/active_outbox/outboxable_spec.rb +++ b/spec/lib/active_outbox/outboxable_spec.rb @@ -108,6 +108,18 @@ 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) + allow(ActiveOutbox.configuration).to receive(:outbox_mapping).and_return({ 'default' => nil }) + end + + it 'raises an error' do + expect { save_instance }.to raise_error(ActiveOutbox::OutboxClassNotFoundError) + end + 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 142a043..de1cf4e 100644 --- a/spec/support/00_outbox_config.rb +++ b/spec/support/00_outbox_config.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true ActiveOutbox.configure do |config| + # byebug config.outbox_mapping.merge!( 'default' => 'Outbox' )