diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-03 09:11:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-03 09:11:13 +0300 |
commit | 27a12ac52d8f27af0ec84c516dc1eebbbc74a6b0 (patch) | |
tree | 6e9ff80f5ed0d25bd1d2c561fdf21e0336833595 /spec/requests | |
parent | b22a67f80e0ea9a6be49b6f8e30257c76735ab6f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/explore/catalog_controller_spec.rb | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/spec/requests/explore/catalog_controller_spec.rb b/spec/requests/explore/catalog_controller_spec.rb index e75b0bba5a6..59a5dcffd3c 100644 --- a/spec/requests/explore/catalog_controller_spec.rb +++ b/spec/requests/explore/catalog_controller_spec.rb @@ -13,10 +13,6 @@ RSpec.describe Explore::CatalogController, feature_category: :pipeline_compositi catalog_resource.project.add_reporter(user) end - before do - sign_in(user) - end - shared_examples 'basic get requests' do |action| let(:path) do if action == :index @@ -34,6 +30,10 @@ RSpec.describe Explore::CatalogController, feature_category: :pipeline_compositi end describe 'GET #show' do + before do + sign_in(user) + end + it_behaves_like 'basic get requests', :show context 'when rendering a draft catalog resource' do @@ -56,14 +56,30 @@ RSpec.describe Explore::CatalogController, feature_category: :pipeline_compositi end describe 'GET #index' do - let(:subject) { get explore_catalog_index_path } + subject(:visit_explore_catalog) { get explore_catalog_index_path } + + context 'with an authenticated user' do + before do + sign_in(user) + end - it_behaves_like 'basic get requests', :index + it_behaves_like 'basic get requests', :index - it_behaves_like 'internal event tracking' do - let(:namespace) { user.namespace } - let(:project) { nil } - let(:event) { 'unique_users_visiting_ci_catalog' } + it_behaves_like 'internal event tracking' do + let(:namespace) { user.namespace } + let(:project) { nil } + let(:event) { 'unique_users_visiting_ci_catalog' } + end + end + + context 'with an anonymous user' do + it_behaves_like 'basic get requests', :index + + it 'does not track the event' do + expect(Gitlab::InternalEvents).not_to receive(:track_event) + + visit_explore_catalog + end end end end |