Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-07-19 17:16:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-07-19 17:16:28 +0300
commite4384360a16dd9a19d4d2d25d0ef1f2b862ed2a6 (patch)
tree2fcdfa7dcdb9db8f5208b2562f4b4e803d671243 /spec/graphql/types
parentffda4e7bcac36987f936b4ba515995a6698698f0 (diff)
Add latest changes from gitlab-org/gitlab@16-2-stable-eev16.2.0-rc42
Diffstat (limited to 'spec/graphql/types')
-rw-r--r--spec/graphql/types/alert_management/alert_type_spec.rb1
-rw-r--r--spec/graphql/types/ci/detailed_status_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/group_variable_type_spec.rb4
-rw-r--r--spec/graphql/types/ci/project_variable_type_spec.rb4
-rw-r--r--spec/graphql/types/commit_signatures/verification_status_enum_spec.rb2
-rw-r--r--spec/graphql/types/deployment_tag_type_spec.rb (renamed from spec/graphql/types/detployment_tag_type_spec.rb)2
-rw-r--r--spec/graphql/types/environment_type_spec.rb2
-rw-r--r--spec/graphql/types/global_id_type_spec.rb6
-rw-r--r--spec/graphql/types/ide_type_spec.rb15
-rw-r--r--spec/graphql/types/issue_type_spec.rb1
-rw-r--r--spec/graphql/types/metrics/dashboard_type_spec.rb22
-rw-r--r--spec/graphql/types/project_statistics_type_spec.rb4
-rw-r--r--spec/graphql/types/project_type_spec.rb8
-rw-r--r--spec/graphql/types/root_storage_statistics_type_spec.rb6
-rw-r--r--spec/graphql/types/user_type_spec.rb42
15 files changed, 81 insertions, 40 deletions
diff --git a/spec/graphql/types/alert_management/alert_type_spec.rb b/spec/graphql/types/alert_management/alert_type_spec.rb
index 4428fc0683a..92e8104fc4d 100644
--- a/spec/graphql/types/alert_management/alert_type_spec.rb
+++ b/spec/graphql/types/alert_management/alert_type_spec.rb
@@ -31,7 +31,6 @@ RSpec.describe GitlabSchema.types['AlertManagementAlert'], feature_category: :in
assignees
notes
discussions
- metrics_dashboard_url
runbook
todos
details_url
diff --git a/spec/graphql/types/ci/detailed_status_type_spec.rb b/spec/graphql/types/ci/detailed_status_type_spec.rb
index 81ab1b52552..69fb2bc43c0 100644
--- a/spec/graphql/types/ci/detailed_status_type_spec.rb
+++ b/spec/graphql/types/ci/detailed_status_type_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Types::Ci::DetailedStatusType do
include GraphqlHelpers
- let_it_be(:stage) { create(:ci_stage, status: :skipped) }
+ let_it_be(:stage) { create(:ci_stage, status: :manual) }
specify { expect(described_class.graphql_name).to eq('DetailedStatus') }
diff --git a/spec/graphql/types/ci/group_variable_type_spec.rb b/spec/graphql/types/ci/group_variable_type_spec.rb
index 106935642f2..ef6d8279523 100644
--- a/spec/graphql/types/ci/group_variable_type_spec.rb
+++ b/spec/graphql/types/ci/group_variable_type_spec.rb
@@ -5,5 +5,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['CiGroupVariable'] do
specify { expect(described_class.interfaces).to contain_exactly(Types::Ci::VariableInterface) }
- specify { expect(described_class).to have_graphql_fields(:environment_scope, :masked, :protected).at_least }
+ specify do
+ expect(described_class).to have_graphql_fields(:environment_scope, :masked, :protected, :description).at_least
+ end
end
diff --git a/spec/graphql/types/ci/project_variable_type_spec.rb b/spec/graphql/types/ci/project_variable_type_spec.rb
index e6e045b2bca..cec0753fcba 100644
--- a/spec/graphql/types/ci/project_variable_type_spec.rb
+++ b/spec/graphql/types/ci/project_variable_type_spec.rb
@@ -5,5 +5,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['CiProjectVariable'] do
specify { expect(described_class.interfaces).to contain_exactly(Types::Ci::VariableInterface) }
- specify { expect(described_class).to have_graphql_fields(:environment_scope, :masked, :protected).at_least }
+ specify do
+ expect(described_class).to have_graphql_fields(:environment_scope, :masked, :protected, :description).at_least
+ end
end
diff --git a/spec/graphql/types/commit_signatures/verification_status_enum_spec.rb b/spec/graphql/types/commit_signatures/verification_status_enum_spec.rb
index a0d99f5f0c1..7fc600745df 100644
--- a/spec/graphql/types/commit_signatures/verification_status_enum_spec.rb
+++ b/spec/graphql/types/commit_signatures/verification_status_enum_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe GitlabSchema.types['VerificationStatus'] do
.to match_array(%w[
UNVERIFIED UNVERIFIED_KEY VERIFIED
SAME_USER_DIFFERENT_EMAIL OTHER_USER UNKNOWN_KEY
- MULTIPLE_SIGNATURES REVOKED_KEY
+ MULTIPLE_SIGNATURES REVOKED_KEY VERIFIED_SYSTEM
])
end
end
diff --git a/spec/graphql/types/detployment_tag_type_spec.rb b/spec/graphql/types/deployment_tag_type_spec.rb
index 9a7a8db0970..b6741c208fe 100644
--- a/spec/graphql/types/detployment_tag_type_spec.rb
+++ b/spec/graphql/types/deployment_tag_type_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe GitlabSchema.types['DeploymentTag'] do
+RSpec.describe GitlabSchema.types['DeploymentTag'], feature_category: :continuous_delivery do
specify { expect(described_class.graphql_name).to eq('DeploymentTag') }
it 'has the expected fields' do
diff --git a/spec/graphql/types/environment_type_spec.rb b/spec/graphql/types/environment_type_spec.rb
index 721c20efc81..1d1bc4b2cb4 100644
--- a/spec/graphql/types/environment_type_spec.rb
+++ b/spec/graphql/types/environment_type_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe GitlabSchema.types['Environment'] do
it 'includes the expected fields' do
expected_fields = %w[
- name id state metrics_dashboard latest_opened_most_severe_alert path external_url deployments
+ name id state latest_opened_most_severe_alert path external_url deployments
slug createdAt updatedAt autoStopAt autoDeleteAt tier environmentType lastDeployment deployFreezes
clusterAgent
]
diff --git a/spec/graphql/types/global_id_type_spec.rb b/spec/graphql/types/global_id_type_spec.rb
index fa0b34113bc..8ce0bc2b70a 100644
--- a/spec/graphql/types/global_id_type_spec.rb
+++ b/spec/graphql/types/global_id_type_spec.rb
@@ -105,12 +105,12 @@ RSpec.describe Types::GlobalIDType do
around do |example|
# Unset all previously memoized GlobalIDTypes to allow us to define one
# that will use the constants stubbed in the `before` block.
- previous_id_types = Types::GlobalIDType.instance_variable_get(:@id_types)
- Types::GlobalIDType.instance_variable_set(:@id_types, {})
+ previous_id_types = described_class.instance_variable_get(:@id_types)
+ described_class.instance_variable_set(:@id_types, {})
example.run
ensure
- Types::GlobalIDType.instance_variable_set(:@id_types, previous_id_types)
+ described_class.instance_variable_set(:@id_types, previous_id_types)
end
before do
diff --git a/spec/graphql/types/ide_type_spec.rb b/spec/graphql/types/ide_type_spec.rb
new file mode 100644
index 00000000000..b0e43332fa8
--- /dev/null
+++ b/spec/graphql/types/ide_type_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['Ide'], feature_category: :web_ide do
+ specify { expect(described_class.graphql_name).to eq('Ide') }
+
+ it 'has the expected fields' do
+ expected_fields = %w[
+ codeSuggestionsEnabled
+ ]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/issue_type_spec.rb b/spec/graphql/types/issue_type_spec.rb
index a9fe85ac62f..7c4f2a06147 100644
--- a/spec/graphql/types/issue_type_spec.rb
+++ b/spec/graphql/types/issue_type_spec.rb
@@ -266,7 +266,6 @@ RSpec.describe GitlabSchema.types['Issue'] do
context 'for an incident' do
before do
issue.update!(
- issue_type: WorkItems::Type.base_types[:incident],
work_item_type: WorkItems::Type.default_by_type(:incident)
)
end
diff --git a/spec/graphql/types/metrics/dashboard_type_spec.rb b/spec/graphql/types/metrics/dashboard_type_spec.rb
deleted file mode 100644
index 114db87d5f1..00000000000
--- a/spec/graphql/types/metrics/dashboard_type_spec.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe GitlabSchema.types['MetricsDashboard'] do
- specify { expect(described_class.graphql_name).to eq('MetricsDashboard') }
-
- it 'has the expected fields' do
- expected_fields = %w[
- path annotations schema_validation_warnings
- ]
-
- expect(described_class).to have_graphql_fields(*expected_fields)
- end
-
- describe 'annotations field' do
- subject { described_class.fields['annotations'] }
-
- it { is_expected.to have_graphql_type(Types::Metrics::Dashboards::AnnotationType.connection_type) }
- it { is_expected.to have_graphql_resolver(Resolvers::Metrics::Dashboards::AnnotationResolver) }
- end
-end
diff --git a/spec/graphql/types/project_statistics_type_spec.rb b/spec/graphql/types/project_statistics_type_spec.rb
index a958a5150aa..558ff41f6f4 100644
--- a/spec/graphql/types/project_statistics_type_spec.rb
+++ b/spec/graphql/types/project_statistics_type_spec.rb
@@ -3,8 +3,8 @@
require 'spec_helper'
RSpec.describe GitlabSchema.types['ProjectStatistics'] do
- it 'has all the required fields' do
- expect(described_class).to have_graphql_fields(:storage_size, :repository_size, :lfs_objects_size,
+ it 'has the expected fields' do
+ expect(described_class).to include_graphql_fields(:storage_size, :repository_size, :lfs_objects_size,
:build_artifacts_size, :packages_size, :commit_count,
:wiki_size, :snippets_size, :pipeline_artifacts_size,
:uploads_size, :container_registry_size)
diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb
index bcfdb05ca90..262164a0821 100644
--- a/spec/graphql/types/project_type_spec.rb
+++ b/spec/graphql/types/project_type_spec.rb
@@ -909,6 +909,14 @@ RSpec.describe GitlabSchema.types['Project'] do
expect(forks).to contain_exactly(a_hash_including('fullPath' => fork_developer.full_path),
a_hash_including('fullPath' => fork_group_developer.full_path))
end
+
+ context 'when current user is not set' do
+ let(:user) { nil }
+
+ it 'does not return any forks' do
+ expect(forks.count).to eq(0)
+ end
+ end
end
end
end
diff --git a/spec/graphql/types/root_storage_statistics_type_spec.rb b/spec/graphql/types/root_storage_statistics_type_spec.rb
index 56f58825db0..00f4092baf4 100644
--- a/spec/graphql/types/root_storage_statistics_type_spec.rb
+++ b/spec/graphql/types/root_storage_statistics_type_spec.rb
@@ -5,11 +5,11 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['RootStorageStatistics'] do
specify { expect(described_class.graphql_name).to eq('RootStorageStatistics') }
- it 'has all the required fields' do
- expect(described_class).to have_graphql_fields(:storage_size, :repository_size, :lfs_objects_size,
+ it 'has the expected fields' do
+ expect(described_class).to include_graphql_fields(:storage_size, :repository_size, :lfs_objects_size,
:build_artifacts_size, :packages_size, :wiki_size, :snippets_size,
:pipeline_artifacts_size, :uploads_size, :dependency_proxy_size,
- :container_registry_size, :registry_size_estimated)
+ :container_registry_size, :container_registry_size_is_estimated, :registry_size_estimated)
end
specify { expect(described_class).to require_graphql_authorizations(:read_statistics) }
diff --git a/spec/graphql/types/user_type_spec.rb b/spec/graphql/types/user_type_spec.rb
index 777972df88b..af0f8a86b6c 100644
--- a/spec/graphql/types/user_type_spec.rb
+++ b/spec/graphql/types/user_type_spec.rb
@@ -55,6 +55,8 @@ RSpec.describe GitlabSchema.types['User'], feature_category: :user_profile do
organization
jobTitle
createdAt
+ pronouns
+ ide
]
expect(described_class).to include_graphql_fields(*expected_fields)
@@ -77,13 +79,13 @@ RSpec.describe GitlabSchema.types['User'], feature_category: :user_profile do
let(:username) { requested_user.username }
let(:query) do
- %(
+ <<~GQL
query {
user(username: "#{username}") {
name
}
}
- )
+ GQL
end
subject(:user_name) { GitlabSchema.execute(query, context: { current_user: current_user }).as_json.dig('data', 'user', 'name') }
@@ -254,4 +256,40 @@ RSpec.describe GitlabSchema.types['User'], feature_category: :user_profile do
is_expected.to have_graphql_type(Types::Users::NamespaceCommitEmailType.connection_type)
end
end
+
+ describe 'ide field' do
+ subject { described_class.fields['ide'] }
+
+ it 'returns ide' do
+ is_expected.to have_graphql_type(Types::IdeType)
+ end
+
+ context 'code suggestions enabled' do
+ let(:current_user) { create(:user) }
+ let(:query) do
+ <<~GQL
+ query {
+ currentUser {
+ ide {
+ codeSuggestionsEnabled
+ }
+ }
+ }
+ GQL
+ end
+
+ subject(:code_suggestions_enabled) do
+ GitlabSchema.execute(query, context: { current_user: current_user })
+ .as_json
+ .dig('data', 'currentUser', 'ide', 'codeSuggestionsEnabled')
+ end
+
+ it 'returns code suggestions enabled' do
+ allow(current_user).to receive(:can?).with(:access_code_suggestions).and_return(true)
+
+ expect(current_user).to receive(:can?).with(:access_code_suggestions).and_return(true)
+ expect(code_suggestions_enabled).to be true
+ end
+ end
+ end
end