summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-11 13:22:01 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-11 13:22:16 +0000
commit01496e9337972f1ea0256bcd1e12996edb883e54 (patch)
treeeed61c95985d0afaedf97c9c661018d5cc60d545 /spec/requests
parent8db23545d53ecbd4ea6438f59ab12513d873bf18 (diff)
downloadgitlab-ce-01496e9337972f1ea0256bcd1e12996edb883e54.tar.gz
Add latest changes from gitlab-org/gitlab@15-7-stable-ee
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/container_registry_event_spec.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/spec/requests/api/container_registry_event_spec.rb b/spec/requests/api/container_registry_event_spec.rb
index 32c4b0e9598..64c17bc2eef 100644
--- a/spec/requests/api/container_registry_event_spec.rb
+++ b/spec/requests/api/container_registry_event_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe API::ContainerRegistryEvent, feature_category: :container_registry do
let(:secret_token) { 'secret_token' }
- let(:events) { [{ action: 'push' }] }
+ let(:events) { [{ action: 'push' }, { action: 'pull' }] }
let(:registry_headers) { { 'Content-Type' => ::API::ContainerRegistryEvent::DOCKER_DISTRIBUTION_EVENTS_V1_JSON } }
describe 'POST /container_registry_event/events' do
@@ -19,14 +19,15 @@ RSpec.describe API::ContainerRegistryEvent, feature_category: :container_registr
end
it 'returns 200 status and events are passed to event handler' do
- event = spy(:event)
- allow(::ContainerRegistry::Event).to receive(:new).and_return(event)
- expect(event).to receive(:supported?).and_return(true)
+ allow_next_instance_of(::ContainerRegistry::Event) do |event|
+ if event.supported?
+ expect(event).to receive(:handle!).once
+ expect(event).to receive(:track!).once
+ end
+ end
post_events
- expect(event).to have_received(:handle!).once
- expect(event).to have_received(:track!).once
expect(response).to have_gitlab_http_status(:ok)
end