diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-30 00:08:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-30 00:08:13 +0300 |
commit | 3a0c37bae20a5cebad0252fb181e65092117b4ef (patch) | |
tree | c9ad28f9c8da942cec76e0b012c41d4af26aa6ac /spec/requests/api/container_registry_event_spec.rb | |
parent | 2dcdb22ddf7f36f4f9581737bc4e639655e9f178 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/container_registry_event_spec.rb')
-rw-r--r-- | spec/requests/api/container_registry_event_spec.rb | 13 |
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 |