summaryrefslogtreecommitdiff
path: root/spec/graphql/types
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /spec/graphql/types
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
downloadgitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/graphql/types')
-rw-r--r--spec/graphql/types/alert_management/alert_type_spec.rb4
-rw-r--r--spec/graphql/types/board_list_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/group_type_spec.rb17
-rw-r--r--spec/graphql/types/ci/job_type_spec.rb16
-rw-r--r--spec/graphql/types/ci/stage_type_spec.rb16
-rw-r--r--spec/graphql/types/ci_configuration/sast/analyzers_entity_type_spec.rb11
-rw-r--r--spec/graphql/types/ci_configuration/sast/entity_type_spec.rb11
-rw-r--r--spec/graphql/types/ci_configuration/sast/options_entity_spec.rb11
-rw-r--r--spec/graphql/types/ci_configuration/sast/type_spec.rb11
-rw-r--r--spec/graphql/types/commit_type_spec.rb4
-rw-r--r--spec/graphql/types/countable_connection_type_spec.rb (renamed from spec/graphql/types/issue_connection_type_spec.rb)0
-rw-r--r--spec/graphql/types/design_management/design_at_version_type_spec.rb1
-rw-r--r--spec/graphql/types/environment_type_spec.rb67
-rw-r--r--spec/graphql/types/group_type_spec.rb2
-rw-r--r--spec/graphql/types/issue_status_count_type_spec.rb17
-rw-r--r--spec/graphql/types/issue_type_enum_spec.rb13
-rw-r--r--spec/graphql/types/issue_type_spec.rb12
-rw-r--r--spec/graphql/types/merge_request_type_spec.rb4
-rw-r--r--spec/graphql/types/project_type_spec.rb106
-rw-r--r--spec/graphql/types/prometheus_alert_type_spec.rb17
-rw-r--r--spec/graphql/types/query_type_spec.rb1
-rw-r--r--spec/graphql/types/snippet_type_spec.rb2
-rw-r--r--spec/graphql/types/snippets/blob_action_enum_spec.rb (renamed from spec/graphql/types/snippets/file_input_action_enum_spec.rb)4
-rw-r--r--spec/graphql/types/snippets/blob_action_input_type_spec.rb (renamed from spec/graphql/types/snippets/file_input_type_spec.rb)8
-rw-r--r--spec/graphql/types/snippets/blob_viewer_type_spec.rb4
-rw-r--r--spec/graphql/types/time_type_spec.rb10
-rw-r--r--spec/graphql/types/tree/blob_type_spec.rb2
-rw-r--r--spec/graphql/types/tree/tree_entry_type_spec.rb2
-rw-r--r--spec/graphql/types/user_status_type_spec.rb17
-rw-r--r--spec/graphql/types/user_type_spec.rb3
30 files changed, 237 insertions, 158 deletions
diff --git a/spec/graphql/types/alert_management/alert_type_spec.rb b/spec/graphql/types/alert_management/alert_type_spec.rb
index 45ac673986d..e14c189d4b6 100644
--- a/spec/graphql/types/alert_management/alert_type_spec.rb
+++ b/spec/graphql/types/alert_management/alert_type_spec.rb
@@ -28,6 +28,10 @@ RSpec.describe GitlabSchema.types['AlertManagementAlert'] do
notes
discussions
metrics_dashboard_url
+ runbook
+ todos
+ details_url
+ prometheus_alert
]
expect(described_class).to have_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/board_list_type_spec.rb b/spec/graphql/types/board_list_type_spec.rb
index 046d1e92bfa..7976936fc1f 100644
--- a/spec/graphql/types/board_list_type_spec.rb
+++ b/spec/graphql/types/board_list_type_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe GitlabSchema.types['BoardList'] do
specify { expect(described_class.graphql_name).to eq('BoardList') }
it 'has specific fields' do
- expected_fields = %w[id list_type position label]
+ expected_fields = %w[id list_type position label issues_count issues]
expect(described_class).to include_graphql_fields(*expected_fields)
end
diff --git a/spec/graphql/types/ci/group_type_spec.rb b/spec/graphql/types/ci/group_type_spec.rb
new file mode 100644
index 00000000000..8d547b19af3
--- /dev/null
+++ b/spec/graphql/types/ci/group_type_spec.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::Ci::GroupType do
+ specify { expect(described_class.graphql_name).to eq('CiGroup') }
+
+ it 'exposes the expected fields' do
+ expected_fields = %i[
+ name
+ size
+ jobs
+ ]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/ci/job_type_spec.rb b/spec/graphql/types/ci/job_type_spec.rb
new file mode 100644
index 00000000000..faf3a95cf25
--- /dev/null
+++ b/spec/graphql/types/ci/job_type_spec.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::Ci::JobType do
+ specify { expect(described_class.graphql_name).to eq('CiJob') }
+
+ it 'exposes the expected fields' do
+ expected_fields = %i[
+ name
+ needs
+ ]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/ci/stage_type_spec.rb b/spec/graphql/types/ci/stage_type_spec.rb
new file mode 100644
index 00000000000..0c352ed27aa
--- /dev/null
+++ b/spec/graphql/types/ci/stage_type_spec.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::Ci::StageType do
+ specify { expect(described_class.graphql_name).to eq('CiStage') }
+
+ it 'exposes the expected fields' do
+ expected_fields = %i[
+ name
+ groups
+ ]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/ci_configuration/sast/analyzers_entity_type_spec.rb b/spec/graphql/types/ci_configuration/sast/analyzers_entity_type_spec.rb
deleted file mode 100644
index 34a22feeaf5..00000000000
--- a/spec/graphql/types/ci_configuration/sast/analyzers_entity_type_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe GitlabSchema.types['SastCiConfigurationAnalyzersEntity'] do
- let(:fields) { %i[name label enabled description] }
-
- it { expect(described_class.graphql_name).to eq('SastCiConfigurationAnalyzersEntity') }
-
- it { expect(described_class).to have_graphql_fields(fields) }
-end
diff --git a/spec/graphql/types/ci_configuration/sast/entity_type_spec.rb b/spec/graphql/types/ci_configuration/sast/entity_type_spec.rb
deleted file mode 100644
index 7c6ad013d4a..00000000000
--- a/spec/graphql/types/ci_configuration/sast/entity_type_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe GitlabSchema.types['SastCiConfigurationEntity'] do
- let(:fields) { %i[field label description type options default_value value] }
-
- it { expect(described_class.graphql_name).to eq('SastCiConfigurationEntity') }
-
- it { expect(described_class).to have_graphql_fields(fields) }
-end
diff --git a/spec/graphql/types/ci_configuration/sast/options_entity_spec.rb b/spec/graphql/types/ci_configuration/sast/options_entity_spec.rb
deleted file mode 100644
index c60c8b9c84a..00000000000
--- a/spec/graphql/types/ci_configuration/sast/options_entity_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe GitlabSchema.types['SastCiConfigurationOptionsEntity'] do
- let(:fields) { %i[label value] }
-
- it { expect(described_class.graphql_name).to eq('SastCiConfigurationOptionsEntity') }
-
- it { expect(described_class).to have_graphql_fields(fields) }
-end
diff --git a/spec/graphql/types/ci_configuration/sast/type_spec.rb b/spec/graphql/types/ci_configuration/sast/type_spec.rb
deleted file mode 100644
index e7a8cd436e4..00000000000
--- a/spec/graphql/types/ci_configuration/sast/type_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe GitlabSchema.types['SastCiConfiguration'] do
- let(:fields) { %i[global pipeline analyzers] }
-
- it { expect(described_class.graphql_name).to eq('SastCiConfiguration') }
-
- it { expect(described_class).to have_graphql_fields(fields) }
-end
diff --git a/spec/graphql/types/commit_type_spec.rb b/spec/graphql/types/commit_type_spec.rb
index 75984786972..d222287270d 100644
--- a/spec/graphql/types/commit_type_spec.rb
+++ b/spec/graphql/types/commit_type_spec.rb
@@ -9,8 +9,8 @@ RSpec.describe GitlabSchema.types['Commit'] do
it 'contains attributes related to commit' do
expect(described_class).to have_graphql_fields(
- :id, :sha, :title, :description, :message, :title_html, :authored_date,
- :author_name, :author_gravatar, :author, :web_url, :latest_pipeline,
+ :id, :sha, :title, :description, :description_html, :message, :title_html, :authored_date,
+ :author_name, :author_gravatar, :author, :web_url, :web_path, :latest_pipeline,
:pipelines, :signature_html
)
end
diff --git a/spec/graphql/types/issue_connection_type_spec.rb b/spec/graphql/types/countable_connection_type_spec.rb
index af34611ecfe..af34611ecfe 100644
--- a/spec/graphql/types/issue_connection_type_spec.rb
+++ b/spec/graphql/types/countable_connection_type_spec.rb
diff --git a/spec/graphql/types/design_management/design_at_version_type_spec.rb b/spec/graphql/types/design_management/design_at_version_type_spec.rb
index 5a6292c924a..4d61ecf62cc 100644
--- a/spec/graphql/types/design_management/design_at_version_type_spec.rb
+++ b/spec/graphql/types/design_management/design_at_version_type_spec.rb
@@ -10,6 +10,7 @@ RSpec.describe GitlabSchema.types['DesignAtVersion'] do
version = design.versions.first
GitlabSchema.id_from_object(create(:design_at_version, design: design, version: version))
end
+
let_it_be(:object_id_b) { GitlabSchema.id_from_object(create(:design_at_version)) }
let(:object_type) { ::Types::DesignManagement::DesignAtVersionType }
end
diff --git a/spec/graphql/types/environment_type_spec.rb b/spec/graphql/types/environment_type_spec.rb
index f7522cb3e2c..abeeeba543f 100644
--- a/spec/graphql/types/environment_type_spec.rb
+++ b/spec/graphql/types/environment_type_spec.rb
@@ -7,11 +7,76 @@ RSpec.describe GitlabSchema.types['Environment'] do
it 'has the expected fields' do
expected_fields = %w[
- name id state metrics_dashboard
+ name id state metrics_dashboard latest_opened_most_severe_alert
]
expect(described_class).to have_graphql_fields(*expected_fields)
end
specify { expect(described_class).to require_graphql_authorizations(:read_environment) }
+
+ context 'when there is an environment' do
+ let_it_be(:project) { create(:project) }
+ let_it_be(:environment) { create(:environment, project: project) }
+ let_it_be(:user) { create(:user) }
+
+ subject { GitlabSchema.execute(query, context: { current_user: user }).as_json }
+
+ let(:query) do
+ %(
+ query {
+ project(fullPath: "#{project.full_path}") {
+ environment(name: "#{environment.name}") {
+ name
+ state
+ }
+ }
+ }
+ )
+ end
+
+ before do
+ project.add_developer(user)
+ end
+
+ it 'returns an environment' do
+ expect(subject['data']['project']['environment']['name']).to eq(environment.name)
+ end
+
+ context 'when query alert data for the environment' do
+ let_it_be(:query) do
+ %(
+ query {
+ project(fullPath: "#{project.full_path}") {
+ environment(name: "#{environment.name}") {
+ name
+ state
+ latestOpenedMostSevereAlert {
+ severity
+ title
+ detailsUrl
+ prometheusAlert {
+ humanizedText
+ }
+ }
+ }
+ }
+ }
+ )
+ end
+
+ it 'does not return alert information' do
+ expect(subject['data']['project']['environment']['latestOpenedMostSevereAlert']).to be_nil
+ end
+
+ context 'when alert is raised on the environment' do
+ let!(:prometheus_alert) { create(:prometheus_alert, project: project, environment: environment) }
+ let!(:alert) { create(:alert_management_alert, :triggered, :prometheus, project: project, environment: environment, prometheus_alert: prometheus_alert) }
+
+ it 'returns alert information' do
+ expect(subject['data']['project']['environment']['latestOpenedMostSevereAlert']['severity']).to eq(alert.severity.upcase)
+ end
+ end
+ end
+ end
end
diff --git a/spec/graphql/types/group_type_spec.rb b/spec/graphql/types/group_type_spec.rb
index fb79e9bb85b..0b87805c2ef 100644
--- a/spec/graphql/types/group_type_spec.rb
+++ b/spec/graphql/types/group_type_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe GitlabSchema.types['Group'] do
web_url avatar_url share_with_group_lock project_creation_level
subgroup_creation_level require_two_factor_authentication
two_factor_grace_period auto_devops_enabled emails_disabled
- mentions_disabled parent boards
+ mentions_disabled parent boards milestones
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/issue_status_count_type_spec.rb b/spec/graphql/types/issue_status_count_type_spec.rb
new file mode 100644
index 00000000000..4e273d6415a
--- /dev/null
+++ b/spec/graphql/types/issue_status_count_type_spec.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['IssueStatusCountsType'] do
+ specify { expect(described_class.graphql_name).to eq('IssueStatusCountsType') }
+
+ it 'exposes the expected fields' do
+ expected_fields = %i[
+ all
+ opened
+ closed
+ ]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/issue_type_enum_spec.rb b/spec/graphql/types/issue_type_enum_spec.rb
new file mode 100644
index 00000000000..7ae5eb76f28
--- /dev/null
+++ b/spec/graphql/types/issue_type_enum_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::IssueTypeEnum do
+ specify { expect(described_class.graphql_name).to eq('IssueType') }
+
+ it 'exposes all the existing issue type values' do
+ expect(described_class.values.keys).to include(
+ *%w[ISSUE INCIDENT]
+ )
+ end
+end
diff --git a/spec/graphql/types/issue_type_spec.rb b/spec/graphql/types/issue_type_spec.rb
index 4a86b07ab1c..24353f8fe3a 100644
--- a/spec/graphql/types/issue_type_spec.rb
+++ b/spec/graphql/types/issue_type_spec.rb
@@ -132,14 +132,14 @@ RSpec.describe GitlabSchema.types['Issue'] do
let(:query) do
%(
query {
- project(fullPath:"#{project.full_path}"){
- issue(iid:"#{issue.iid}"){
+ project(fullPath: "#{project.full_path}") {
+ issue(iid: "#{issue.iid}") {
descriptionHtml
- notes{
- edges{
- node{
+ notes {
+ edges {
+ node {
bodyHtml
- author{
+ author {
username
}
body
diff --git a/spec/graphql/types/merge_request_type_spec.rb b/spec/graphql/types/merge_request_type_spec.rb
index b3dccde8ce3..b11951190e0 100644
--- a/spec/graphql/types/merge_request_type_spec.rb
+++ b/spec/graphql/types/merge_request_type_spec.rb
@@ -24,9 +24,11 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do
source_branch_exists target_branch_exists
upvotes downvotes head_pipeline pipelines task_completion_status
milestone assignees participants subscribed labels discussion_locked time_estimate
- total_time_spent reference author merged_at
+ total_time_spent reference author merged_at commit_count
]
+ expected_fields << 'approved_by' if Gitlab.ee?
+
expect(described_class).to have_graphql_fields(*expected_fields)
end
end
diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb
index ea88ed6a3f5..8a5d0cdf12d 100644
--- a/spec/graphql/types/project_type_spec.rb
+++ b/spec/graphql/types/project_type_spec.rb
@@ -22,11 +22,12 @@ RSpec.describe GitlabSchema.types['Project'] do
only_allow_merge_if_pipeline_succeeds request_access_enabled
only_allow_merge_if_all_discussions_are_resolved printing_merge_request_link_enabled
namespace group statistics repository merge_requests merge_request issues
- issue pipelines removeSourceBranchAfterMerge sentryDetailedError snippets
+ issue milestones pipelines removeSourceBranchAfterMerge sentryDetailedError snippets
grafanaIntegration autocloseReferencedIssues suggestion_commit_message environments
- boards jira_import_status jira_imports services releases release
+ environment boards jira_import_status jira_imports services releases release
alert_management_alerts alert_management_alert alert_management_alert_status_counts
- container_expiration_policy sast_ci_configuration service_desk_enabled service_desk_address
+ container_expiration_policy service_desk_enabled service_desk_address
+ issue_status_counts
]
expect(described_class).to include_graphql_fields(*expected_fields)
@@ -69,7 +70,9 @@ RSpec.describe GitlabSchema.types['Project'] do
:before,
:after,
:first,
- :last
+ :last,
+ :merged_after,
+ :merged_before
)
end
end
@@ -95,6 +98,13 @@ RSpec.describe GitlabSchema.types['Project'] do
it { is_expected.to have_graphql_resolver(Resolvers::EnvironmentsResolver) }
end
+ describe 'environment field' do
+ subject { described_class.fields['environment'] }
+
+ it { is_expected.to have_graphql_type(Types::EnvironmentType) }
+ it { is_expected.to have_graphql_resolver(Resolvers::EnvironmentsResolver.single) }
+ end
+
describe 'members field' do
subject { described_class.fields['projectMembers'] }
@@ -140,93 +150,5 @@ RSpec.describe GitlabSchema.types['Project'] do
it { is_expected.to have_graphql_type(Types::ContainerExpirationPolicyType) }
end
- describe 'sast_ci_configuration' do
- let_it_be(:project) { create(:project) }
- let_it_be(:user) { create(:user) }
- let_it_be(:query) do
- %(
- query {
- project(fullPath: "#{project.full_path}") {
- sastCiConfiguration {
- global {
- nodes {
- type
- options {
- nodes {
- label
- value
- }
- }
- field
- label
- defaultValue
- value
- }
- }
- pipeline {
- nodes {
- type
- options {
- nodes {
- label
- value
- }
- }
- field
- label
- defaultValue
- value
- }
- }
- analyzers {
- nodes {
- name
- label
- enabled
- }
- }
- }
- }
- }
- )
- end
-
- subject { GitlabSchema.execute(query, context: { current_user: user }).as_json }
-
- before do
- project.add_developer(user)
- end
-
- it "returns the project's sast configuration for global variables" do
- query_result = subject.dig('data', 'project', 'sastCiConfiguration', 'global', 'nodes')
- first_config = query_result.first
- fourth_config = query_result[3]
- expect(first_config['type']).to eq('string')
- expect(first_config['field']).to eq('SECURE_ANALYZERS_PREFIX')
- expect(first_config['label']).to eq('Image prefix')
- expect(first_config['defaultValue']).to eq('registry.gitlab.com/gitlab-org/security-products/analyzers')
- expect(first_config['value']).to eq('')
- expect(first_config['options']).to be_nil
- expect(fourth_config['options']['nodes']).to match([{ "value" => "true", "label" => "true (disables SAST)" },
- { "value" => "false", "label" => "false (enables SAST)" }])
- end
-
- it "returns the project's sast configuration for pipeline variables" do
- configuration = subject.dig('data', 'project', 'sastCiConfiguration', 'pipeline', 'nodes').first
- expect(configuration['type']).to eq('dropdown')
- expect(configuration['field']).to eq('stage')
- expect(configuration['label']).to eq('Stage')
- expect(configuration['defaultValue']).to eq('test')
- expect(configuration['value']).to eq('')
- end
-
- it "returns the project's sast configuration for analyzer variables" do
- configuration = subject.dig('data', 'project', 'sastCiConfiguration', 'analyzers', 'nodes').first
- expect(configuration['name']).to eq('brakeman')
- expect(configuration['label']).to eq('Brakeman')
- expect(configuration['enabled']).to eq(true)
- end
- end
-
it_behaves_like 'a GraphQL type with labels'
end
diff --git a/spec/graphql/types/prometheus_alert_type_spec.rb b/spec/graphql/types/prometheus_alert_type_spec.rb
new file mode 100644
index 00000000000..716537ea716
--- /dev/null
+++ b/spec/graphql/types/prometheus_alert_type_spec.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['PrometheusAlert'] do
+ specify { expect(described_class.graphql_name).to eq('PrometheusAlert') }
+
+ it 'has the expected fields' do
+ expected_fields = %w[
+ id humanized_text
+ ]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+
+ specify { expect(described_class).to require_graphql_authorizations(:read_prometheus_alerts) }
+end
diff --git a/spec/graphql/types/query_type_spec.rb b/spec/graphql/types/query_type_spec.rb
index 081f99a8307..ab13162b406 100644
--- a/spec/graphql/types/query_type_spec.rb
+++ b/spec/graphql/types/query_type_spec.rb
@@ -17,6 +17,7 @@ RSpec.describe GitlabSchema.types['Query'] do
current_user
snippets
design_management
+ milestone
user
users
]
diff --git a/spec/graphql/types/snippet_type_spec.rb b/spec/graphql/types/snippet_type_spec.rb
index 0341ca2c733..86af69f1294 100644
--- a/spec/graphql/types/snippet_type_spec.rb
+++ b/spec/graphql/types/snippet_type_spec.rb
@@ -33,6 +33,7 @@ RSpec.describe GitlabSchema.types['Snippet'] do
}
)
end
+
let(:response) { subject.dig('data', 'snippets', 'nodes')[0] }
subject { GitlabSchema.execute(query, context: { current_user: current_user }).as_json }
@@ -97,6 +98,7 @@ RSpec.describe GitlabSchema.types['Snippet'] do
}
)
end
+
let(:response) { subject.dig('data', 'snippets', 'nodes')[0] }
subject { GitlabSchema.execute(query, context: { current_user: user }).as_json }
diff --git a/spec/graphql/types/snippets/file_input_action_enum_spec.rb b/spec/graphql/types/snippets/blob_action_enum_spec.rb
index ff9b706240b..9c641bd5446 100644
--- a/spec/graphql/types/snippets/file_input_action_enum_spec.rb
+++ b/spec/graphql/types/snippets/blob_action_enum_spec.rb
@@ -2,8 +2,8 @@
require 'spec_helper'
-RSpec.describe Types::Snippets::FileInputActionEnum do
- specify { expect(described_class.graphql_name).to eq('SnippetFileInputActionEnum') }
+RSpec.describe Types::Snippets::BlobActionEnum do
+ specify { expect(described_class.graphql_name).to eq('SnippetBlobActionEnum') }
it 'exposes all file input action types' do
expect(described_class.values.keys).to eq(%w[create update delete move])
diff --git a/spec/graphql/types/snippets/file_input_type_spec.rb b/spec/graphql/types/snippets/blob_action_input_type_spec.rb
index c7d4909b542..5d6bd81fb77 100644
--- a/spec/graphql/types/snippets/file_input_type_spec.rb
+++ b/spec/graphql/types/snippets/blob_action_input_type_spec.rb
@@ -2,14 +2,14 @@
require 'spec_helper'
-RSpec.describe Types::Snippets::FileInputType do
- specify { expect(described_class.graphql_name).to eq('SnippetFileInputType') }
+RSpec.describe Types::Snippets::BlobActionInputType do
+ specify { expect(described_class.graphql_name).to eq('SnippetBlobActionInputType') }
it 'has the correct arguments' do
expect(described_class.arguments.keys).to match_array(%w[filePath action previousPath content])
end
- it 'sets the type of action argument to FileInputActionEnum' do
- expect(described_class.arguments['action'].type.of_type).to eq(Types::Snippets::FileInputActionEnum)
+ it 'sets the type of action argument to BlobActionEnum' do
+ expect(described_class.arguments['action'].type.of_type).to eq(Types::Snippets::BlobActionEnum)
end
end
diff --git a/spec/graphql/types/snippets/blob_viewer_type_spec.rb b/spec/graphql/types/snippets/blob_viewer_type_spec.rb
index 8210eb9a95c..295df992c67 100644
--- a/spec/graphql/types/snippets/blob_viewer_type_spec.rb
+++ b/spec/graphql/types/snippets/blob_viewer_type_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe GitlabSchema.types['SnippetBlobViewer'] do
let(:query) do
%(
query {
- snippets(ids:"#{snippet.to_global_id}"){
+ snippets(ids: "#{snippet.to_global_id}") {
edges {
node {
blob {
@@ -70,7 +70,7 @@ RSpec.describe GitlabSchema.types['SnippetBlobViewer'] do
let(:query) do
%(
query {
- snippets(ids:"#{snippet.to_global_id}"){
+ snippets(ids: "#{snippet.to_global_id}") {
edges {
node {
blob {
diff --git a/spec/graphql/types/time_type_spec.rb b/spec/graphql/types/time_type_spec.rb
index 68d346766c2..3b0d257e1d7 100644
--- a/spec/graphql/types/time_type_spec.rb
+++ b/spec/graphql/types/time_type_spec.rb
@@ -15,4 +15,14 @@ RSpec.describe GitlabSchema.types['Time'] do
it 'coerces an ISO-time into Time object' do
expect(described_class.coerce_isolated_input(iso)).to eq(time)
end
+
+ it 'rejects invalid input' do
+ expect { described_class.coerce_isolated_input('not valid') }
+ .to raise_error(GraphQL::CoercionError)
+ end
+
+ it 'rejects nil' do
+ expect { described_class.coerce_isolated_input(nil) }
+ .to raise_error(GraphQL::CoercionError)
+ end
end
diff --git a/spec/graphql/types/tree/blob_type_spec.rb b/spec/graphql/types/tree/blob_type_spec.rb
index 73d61d4860c..2b08b528e38 100644
--- a/spec/graphql/types/tree/blob_type_spec.rb
+++ b/spec/graphql/types/tree/blob_type_spec.rb
@@ -5,5 +5,5 @@ require 'spec_helper'
RSpec.describe Types::Tree::BlobType do
specify { expect(described_class.graphql_name).to eq('Blob') }
- specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :lfs_oid, :mode) }
+ specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :web_path, :lfs_oid, :mode) }
end
diff --git a/spec/graphql/types/tree/tree_entry_type_spec.rb b/spec/graphql/types/tree/tree_entry_type_spec.rb
index 0e5caf66854..82e05b299fc 100644
--- a/spec/graphql/types/tree/tree_entry_type_spec.rb
+++ b/spec/graphql/types/tree/tree_entry_type_spec.rb
@@ -5,5 +5,5 @@ require 'spec_helper'
RSpec.describe Types::Tree::TreeEntryType do
specify { expect(described_class.graphql_name).to eq('TreeEntry') }
- specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url) }
+ specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :web_path) }
end
diff --git a/spec/graphql/types/user_status_type_spec.rb b/spec/graphql/types/user_status_type_spec.rb
new file mode 100644
index 00000000000..c4421a9cc10
--- /dev/null
+++ b/spec/graphql/types/user_status_type_spec.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::UserStatusType do
+ specify { expect(described_class.graphql_name).to eq('UserStatus') }
+
+ it 'exposes the expected fields' do
+ expected_fields = %i[
+ emoji
+ message
+ message_html
+ ]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/user_type_spec.rb b/spec/graphql/types/user_type_spec.rb
index 6cc3f7bcaa1..7710b8efefe 100644
--- a/spec/graphql/types/user_type_spec.rb
+++ b/spec/graphql/types/user_type_spec.rb
@@ -14,10 +14,13 @@ RSpec.describe GitlabSchema.types['User'] do
snippets
name
username
+ email
avatarUrl
webUrl
+ webPath
todos
state
+ status
authoredMergeRequests
assignedMergeRequests
groupMemberships