diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-21 03:07:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-21 03:07:56 +0300 |
commit | 6fbaac1974d2e9a0e5296a9da2d99f356a684f91 (patch) | |
tree | 965884691ca08bf2c2a00e49a359c30515aaa813 /spec/controllers | |
parent | c972699d3975e61785389602bfc8078d3bc40091 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/graphql_controller_spec.rb | 7 | ||||
-rw-r--r-- | spec/controllers/projects/autocomplete_sources_controller_spec.rb | 34 |
2 files changed, 41 insertions, 0 deletions
diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb index b4a7e41ccd2..da1676138ec 100644 --- a/spec/controllers/graphql_controller_spec.rb +++ b/spec/controllers/graphql_controller_spec.rb @@ -431,6 +431,13 @@ RSpec.describe GraphqlController, feature_category: :integrations do context 'when querying an IntrospectionQuery', :use_clean_rails_memory_store_caching do let_it_be(:query) { File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql')) } + it 'caches IntrospectionQuery even when operationName is not given' do + expect(GitlabSchema).to receive(:execute).exactly(:once) + + post :execute, params: { query: query } + post :execute, params: { query: query } + end + it 'caches the IntrospectionQuery' do expect(GitlabSchema).to receive(:execute).exactly(:once) diff --git a/spec/controllers/projects/autocomplete_sources_controller_spec.rb b/spec/controllers/projects/autocomplete_sources_controller_spec.rb index 70178083e71..d0bfbeae78f 100644 --- a/spec/controllers/projects/autocomplete_sources_controller_spec.rb +++ b/spec/controllers/projects/autocomplete_sources_controller_spec.rb @@ -131,6 +131,10 @@ RSpec.describe Projects::AutocompleteSourcesController do end shared_examples 'all members are returned' do + before do + stub_feature_flags(disable_all_mention: false) + end + it 'returns an array of member object' do get :members, format: :json, params: { namespace_id: group.path, project_id: public_project.path, type: issuable_type } @@ -155,6 +159,19 @@ RSpec.describe Projects::AutocompleteSourcesController do name: invited_private_member.name, avatar_url: invited_private_member.avatar_url) end + + context 'when `disable_all_mention` FF is enabled' do + before do + stub_feature_flags(disable_all_mention: true) + end + + it 'does not return the all mention user' do + get :members, format: :json, params: { namespace_id: group.path, project_id: public_project.path, type: issuable_type } + + expect(json_response).not_to include(a_hash_including( + { username: 'all', name: 'All Project and Group Members' })) + end + end end context 'with issue' do @@ -180,6 +197,10 @@ RSpec.describe Projects::AutocompleteSourcesController do end shared_examples 'only public members are returned for public project' do + before do + stub_feature_flags(disable_all_mention: false) + end + it 'only returns public members' do get :members, format: :json, params: { namespace_id: group.path, project_id: public_project.path, type: issuable_type } @@ -193,6 +214,19 @@ RSpec.describe Projects::AutocompleteSourcesController do name: user.name, avatar_url: user.avatar_url) end + + context 'when `disable_all_mention` FF is enabled' do + before do + stub_feature_flags(disable_all_mention: true) + end + + it 'does not return the all mention user' do + get :members, format: :json, params: { namespace_id: group.path, project_id: public_project.path, type: issuable_type } + + expect(json_response).not_to include(a_hash_including( + { username: 'all', name: 'All Project and Group Members' })) + end + end end context 'with issue' do |