Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb b/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
index 0a07c9d677b..187c0b3ab43 100644
--- a/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
+++ b/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
@@ -162,10 +162,24 @@ RSpec.shared_examples 'model with repository' do
end
describe '#after_repository_change_head' do
+ let(:event) { instance_double('Repositories::DefaultBranchChangedEvent') }
+ let(:event_data) { { container_id: stubbed_container.id, container_type: stubbed_container.class.name } }
+
it 'calls #reload_default_branch' do
expect(stubbed_container).to receive(:reload_default_branch)
stubbed_container.after_repository_change_head
end
+
+ it 'publishes an Repositories::DefaultBranchChangedEvent event' do
+ allow(Repositories::DefaultBranchChangedEvent)
+ .to receive(:new)
+ .with(data: event_data)
+ .and_return(event)
+
+ expect(Gitlab::EventStore).to receive(:publish).with(event).once
+
+ stubbed_container.after_repository_change_head
+ end
end
end