diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-08 06:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-08 06:08:42 +0300 |
commit | 5500dd34b9b489ee5c6609c8988bfe039f37e3e9 (patch) | |
tree | bbb0df8272862f0622cc6886fa76fd2f44107ea1 /spec | |
parent | 53e998950e2dfeed22bec2eff74c5c996fe76856 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
4 files changed, 9 insertions, 19 deletions
diff --git a/spec/requests/api/graphql/ci/application_setting_spec.rb b/spec/requests/api/graphql/ci/application_setting_spec.rb index 42ab1786fee..a0c3bedd493 100644 --- a/spec/requests/api/graphql/ci/application_setting_spec.rb +++ b/spec/requests/api/graphql/ci/application_setting_spec.rb @@ -27,9 +27,7 @@ RSpec.describe 'getting Application Settings', feature_category: :continuous_int post_graphql(query, current_user: user) end - it_behaves_like 'a working graphql query' - - specify { expect(settings_data).to be nil } + it_behaves_like 'a working graphql query that returns no data' end context 'with admin permissions' do @@ -39,7 +37,7 @@ RSpec.describe 'getting Application Settings', feature_category: :continuous_int post_graphql(query, current_user: user) end - it_behaves_like 'a working graphql query' + it_behaves_like 'a working graphql query that returns data' it 'fetches the settings data' do # assert against hash to ensure no additional fields are exposed diff --git a/spec/requests/api/graphql/current_user/todos_query_spec.rb b/spec/requests/api/graphql/current_user/todos_query_spec.rb index ee019a99f8d..790ae4b955e 100644 --- a/spec/requests/api/graphql/current_user/todos_query_spec.rb +++ b/spec/requests/api/graphql/current_user/todos_query_spec.rb @@ -40,7 +40,7 @@ RSpec.describe 'Query current user todos', feature_category: :source_code_manage post_graphql(query, current_user: current_user) end - it_behaves_like 'a working graphql query' + it_behaves_like 'a working graphql query that returns data' it 'contains the expected ids' do is_expected.to contain_exactly( diff --git a/spec/requests/api/graphql/current_user_query_spec.rb b/spec/requests/api/graphql/current_user_query_spec.rb index aceef77920d..b4e570bcaaa 100644 --- a/spec/requests/api/graphql/current_user_query_spec.rb +++ b/spec/requests/api/graphql/current_user_query_spec.rb @@ -25,7 +25,7 @@ RSpec.describe 'getting project information', feature_category: :system_access d context 'when there is a current_user' do let_it_be(:current_user) { create(:user) } - it_behaves_like 'a working graphql query' + it_behaves_like 'a working graphql query that returns data' it { is_expected.to include('name' => current_user.name, 'namespace' => { 'id' => current_user.namespace.to_global_id.to_s }) } end @@ -33,8 +33,6 @@ RSpec.describe 'getting project information', feature_category: :system_access d context 'when there is no current_user' do let(:current_user) { nil } - it_behaves_like 'a working graphql query' - - it { is_expected.to be_nil } + it_behaves_like 'a working graphql query that returns no data' end end diff --git a/spec/requests/api/graphql/project_query_spec.rb b/spec/requests/api/graphql/project_query_spec.rb index 54f141d9401..9f8025872df 100644 --- a/spec/requests/api/graphql/project_query_spec.rb +++ b/spec/requests/api/graphql/project_query_spec.rb @@ -23,7 +23,7 @@ RSpec.describe 'getting project information', feature_category: :groups_and_proj it 'includes the project', :use_clean_rails_memory_store_caching, :request_store do post_graphql(query, current_user: current_user) - expect(graphql_data['project']).not_to be_nil + expect(graphql_data['project']).to include('id' => global_id_of(project).to_s) end end @@ -35,10 +35,10 @@ RSpec.describe 'getting project information', feature_category: :groups_and_proj it 'includes the project' do post_graphql(query, current_user: current_user) - expect(graphql_data['project']).not_to be_nil + expect(graphql_data['project']).to include('id' => global_id_of(project).to_s) end - it_behaves_like 'a working graphql query' do + it_behaves_like 'a working graphql query that returns data' do before do post_graphql(query, current_user: current_user) end @@ -239,13 +239,7 @@ RSpec.describe 'getting project information', feature_category: :groups_and_proj end context 'when the user does not have access to the project' do - it 'returns an empty field' do - post_graphql(query, current_user: current_user) - - expect(graphql_data['project']).to be_nil - end - - it_behaves_like 'a working graphql query' do + it_behaves_like 'a working graphql query that returns no data' do before do post_graphql(query, current_user: current_user) end |