summaryrefslogtreecommitdiff
path: root/spec/requests/api/graphql/ci
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 10:34:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 10:34:06 +0000
commit859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch)
treed7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/requests/api/graphql/ci
parent446d496a6d000c73a304be52587cd9bbc7493136 (diff)
downloadgitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/requests/api/graphql/ci')
-rw-r--r--spec/requests/api/graphql/ci/application_setting_spec.rb49
-rw-r--r--spec/requests/api/graphql/ci/ci_cd_setting_spec.rb2
2 files changed, 50 insertions, 1 deletions
diff --git a/spec/requests/api/graphql/ci/application_setting_spec.rb b/spec/requests/api/graphql/ci/application_setting_spec.rb
new file mode 100644
index 00000000000..156ee550f16
--- /dev/null
+++ b/spec/requests/api/graphql/ci/application_setting_spec.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'getting Application Settings' do
+ include GraphqlHelpers
+
+ let(:fields) do
+ <<~QUERY
+ #{all_graphql_fields_for('CiApplicationSettings', max_depth: 1)}
+ QUERY
+ end
+
+ let(:query) do
+ graphql_query_for(
+ 'ciApplicationSettings',
+ fields
+ )
+ end
+
+ let(:settings_data) { graphql_data['ciApplicationSettings'] }
+
+ context 'without admin permissions' do
+ let(:user) { create(:user) }
+
+ before do
+ post_graphql(query, current_user: user)
+ end
+
+ it_behaves_like 'a working graphql query'
+
+ specify { expect(settings_data).to be nil }
+ end
+
+ context 'with admin permissions' do
+ let(:user) { create(:user, :admin) }
+
+ before do
+ post_graphql(query, current_user: user)
+ end
+
+ it_behaves_like 'a working graphql query'
+
+ it 'fetches the settings data' do
+ # assert against hash to ensure no additional fields are exposed
+ expect(settings_data).to match({ 'keepLatestArtifact' => Gitlab::CurrentSettings.current_application_settings.keep_latest_artifact })
+ end
+ end
+end
diff --git a/spec/requests/api/graphql/ci/ci_cd_setting_spec.rb b/spec/requests/api/graphql/ci/ci_cd_setting_spec.rb
index db8a412e45c..99647d0fa3a 100644
--- a/spec/requests/api/graphql/ci/ci_cd_setting_spec.rb
+++ b/spec/requests/api/graphql/ci/ci_cd_setting_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe 'Getting Ci Cd Setting' do
it 'fetches the settings data' do
expect(settings_data['mergePipelinesEnabled']).to eql project.ci_cd_settings.merge_pipelines_enabled?
expect(settings_data['mergeTrainsEnabled']).to eql project.ci_cd_settings.merge_trains_enabled?
- expect(settings_data['keepLatestArtifact']).to eql project.ci_keep_latest_artifact?
+ expect(settings_data['keepLatestArtifact']).to eql project.keep_latest_artifacts_available?
end
end
end