Skip to content

Commit

Permalink
Fix spec
Browse files Browse the repository at this point in the history
  • Loading branch information
santiagodiaz committed Oct 4, 2023
1 parent ae92a88 commit 1d0b9f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
1 change: 0 additions & 1 deletion lib/active_outbox/outboxable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def namespace_outbox_mapping
end

def default_outbox_mapping
# byebug
ActiveOutbox.configuration.outbox_mapping['default']
end

Expand Down
21 changes: 9 additions & 12 deletions spec/lib/active_outbox/outboxable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }

Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion spec/support/00_outbox_config.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

ActiveOutbox.configure do |config|
# byebug
config.outbox_mapping.merge!(
'default' => 'Outbox'
)
Expand Down

0 comments on commit 1d0b9f1

Please sign in to comment.