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:
Diffstat (limited to 'spec/graphql/types')
-rw-r--r--spec/graphql/types/achievements/achievement_type_spec.rb3
-rw-r--r--spec/graphql/types/ci/job_token_scope_type_spec.rb84
-rw-r--r--spec/graphql/types/ci/job_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/pipeline_schedule_variable_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/pipeline_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/runner_architecture_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/runner_platform_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/runner_setup_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/runner_type_spec.rb3
-rw-r--r--spec/graphql/types/ci/runner_upgrade_status_enum_spec.rb3
-rw-r--r--spec/graphql/types/ci/runner_web_url_edge_spec.rb2
-rw-r--r--spec/graphql/types/ci/variable_sort_enum_spec.rb12
-rw-r--r--spec/graphql/types/commit_signatures/verification_status_enum_spec.rb2
-rw-r--r--spec/graphql/types/group_type_spec.rb9
-rw-r--r--spec/graphql/types/issue_type_spec.rb26
-rw-r--r--spec/graphql/types/notes/deleted_note_type_spec.rb15
-rw-r--r--spec/graphql/types/packages/package_details_type_spec.rb2
-rw-r--r--spec/graphql/types/permission_types/merge_request_spec.rb2
-rw-r--r--spec/graphql/types/permission_types/work_item_spec.rb2
-rw-r--r--spec/graphql/types/project_type_spec.rb64
-rw-r--r--spec/graphql/types/query_type_spec.rb42
-rw-r--r--spec/graphql/types/user_type_spec.rb3
-rw-r--r--spec/graphql/types/users/email_type_spec.rb2
-rw-r--r--spec/graphql/types/users/namespace_commit_email_type_spec.rb2
-rw-r--r--spec/graphql/types/work_item_type_spec.rb1
25 files changed, 204 insertions, 87 deletions
diff --git a/spec/graphql/types/achievements/achievement_type_spec.rb b/spec/graphql/types/achievements/achievement_type_spec.rb
index 5c98753ac66..f967dc8e25e 100644
--- a/spec/graphql/types/achievements/achievement_type_spec.rb
+++ b/spec/graphql/types/achievements/achievement_type_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe GitlabSchema.types['Achievement'], feature_category: :users do
+RSpec.describe GitlabSchema.types['Achievement'], feature_category: :user_profile do
include GraphqlHelpers
let(:fields) do
@@ -12,7 +12,6 @@ RSpec.describe GitlabSchema.types['Achievement'], feature_category: :users do
name
avatar_url
description
- revokeable
created_at
updated_at
]
diff --git a/spec/graphql/types/ci/job_token_scope_type_spec.rb b/spec/graphql/types/ci/job_token_scope_type_spec.rb
index 569b59d6c70..01044364881 100644
--- a/spec/graphql/types/ci/job_token_scope_type_spec.rb
+++ b/spec/graphql/types/ci/job_token_scope_type_spec.rb
@@ -2,17 +2,24 @@
require 'spec_helper'
-RSpec.describe GitlabSchema.types['CiJobTokenScopeType'] do
+RSpec.describe GitlabSchema.types['CiJobTokenScopeType'], feature_category: :continuous_integration do
specify { expect(described_class.graphql_name).to eq('CiJobTokenScopeType') }
it 'has the correct fields' do
- expected_fields = [:projects]
+ expected_fields = [:projects, :inboundAllowlist, :outboundAllowlist]
expect(described_class).to have_graphql_fields(*expected_fields)
end
describe 'query' do
- let(:project) { create(:project, ci_outbound_job_token_scope_enabled: true).tap(&:save!) }
+ let(:project) do
+ create(
+ :project,
+ ci_outbound_job_token_scope_enabled: true,
+ ci_inbound_job_token_scope_enabled: true
+ ).tap(&:save!)
+ end
+
let_it_be(:current_user) { create(:user) }
let(:query) do
@@ -25,6 +32,16 @@ RSpec.describe GitlabSchema.types['CiJobTokenScopeType'] do
path
}
}
+ inboundAllowlist {
+ nodes {
+ path
+ }
+ }
+ outboundAllowlist {
+ nodes {
+ path
+ }
+ }
}
}
}
@@ -33,30 +50,73 @@ RSpec.describe GitlabSchema.types['CiJobTokenScopeType'] do
subject { GitlabSchema.execute(query, context: { current_user: current_user }).as_json }
- let(:projects_field) { subject.dig('data', 'project', 'ciJobTokenScope', 'projects', 'nodes') }
- let(:returned_project_paths) { projects_field.map { |project| project['path'] } }
+ let(:scope_field) { subject.dig('data', 'project', 'ciJobTokenScope') }
+ let(:errors_field) { subject['errors'] }
+ let(:projects_field) { scope_field&.dig('projects', 'nodes') }
+ let(:outbound_allowlist_field) { scope_field&.dig('outboundAllowlist', 'nodes') }
+ let(:inbound_allowlist_field) { scope_field&.dig('inboundAllowlist', 'nodes') }
+ let(:returned_project_paths) { projects_field.map { |p| p['path'] } }
+ let(:returned_outbound_paths) { outbound_allowlist_field.map { |p| p['path'] } }
+ let(:returned_inbound_paths) { inbound_allowlist_field.map { |p| p['path'] } }
+
+ context 'without access to scope' do
+ before do
+ project.add_member(current_user, :developer)
+ end
+
+ it 'returns no projects' do
+ expect(projects_field).to be_nil
+ expect(outbound_allowlist_field).to be_nil
+ expect(inbound_allowlist_field).to be_nil
+ expect(errors_field.first['message']).to include "don't have permission"
+ end
+ end
context 'with access to scope' do
before do
project.add_member(current_user, :maintainer)
end
- context 'when multiple projects in the allow list' do
- let!(:link) { create(:ci_job_token_project_scope_link, source_project: project) }
+ context 'when multiple projects in the allow lists' do
+ include Ci::JobTokenScopeHelpers
+ let!(:outbound_allowlist_project) { create_project_in_allowlist(project, direction: :outbound) }
+ let!(:inbound_allowlist_project) { create_project_in_allowlist(project, direction: :inbound) }
+ let!(:both_allowlists_project) { create_project_in_both_allowlists(project) }
context 'when linked projects are readable' do
before do
- link.target_project.add_member(current_user, :developer)
+ outbound_allowlist_project.add_member(current_user, :developer)
+ inbound_allowlist_project.add_member(current_user, :developer)
+ both_allowlists_project.add_member(current_user, :developer)
end
- it 'returns readable projects in scope' do
- expect(returned_project_paths).to contain_exactly(project.path, link.target_project.path)
+ shared_examples 'returns projects' do
+ it 'returns readable projects in scope' do
+ outbound_paths = [project.path, outbound_allowlist_project.path, both_allowlists_project.path]
+ inbound_paths = [project.path, inbound_allowlist_project.path, both_allowlists_project.path]
+
+ expect(returned_project_paths).to contain_exactly(*outbound_paths)
+ expect(returned_outbound_paths).to contain_exactly(*outbound_paths)
+ expect(returned_inbound_paths).to contain_exactly(*inbound_paths)
+ end
+ end
+
+ it_behaves_like 'returns projects'
+
+ context 'when job token scope is disabled' do
+ before do
+ project.ci_cd_settings.update!(job_token_scope_enabled: false)
+ end
+
+ it_behaves_like 'returns projects'
end
end
- context 'when linked project is not readable' do
+ context 'when linked projects are not readable' do
it 'returns readable projects in scope' do
expect(returned_project_paths).to contain_exactly(project.path)
+ expect(returned_outbound_paths).to contain_exactly(project.path)
+ expect(returned_inbound_paths).to contain_exactly(project.path)
end
end
@@ -71,6 +131,8 @@ RSpec.describe GitlabSchema.types['CiJobTokenScopeType'] do
it 'returns readable projects in scope' do
expect(returned_project_paths).to contain_exactly(project.path)
+ expect(returned_outbound_paths).to contain_exactly(project.path)
+ expect(returned_inbound_paths).to contain_exactly(project.path)
end
end
end
diff --git a/spec/graphql/types/ci/job_type_spec.rb b/spec/graphql/types/ci/job_type_spec.rb
index ce1558c4097..714eaebfe73 100644
--- a/spec/graphql/types/ci/job_type_spec.rb
+++ b/spec/graphql/types/ci/job_type_spec.rb
@@ -22,6 +22,7 @@ RSpec.describe Types::Ci::JobType do
detailedStatus
duration
downstreamPipeline
+ erasedAt
finished_at
id
kind
@@ -32,6 +33,7 @@ RSpec.describe Types::Ci::JobType do
pipeline
playable
previousStageJobsOrNeeds
+ project
queued_at
queued_duration
refName
diff --git a/spec/graphql/types/ci/pipeline_schedule_variable_type_spec.rb b/spec/graphql/types/ci/pipeline_schedule_variable_type_spec.rb
index 1c98539e308..2e5e6ad204f 100644
--- a/spec/graphql/types/ci/pipeline_schedule_variable_type_spec.rb
+++ b/spec/graphql/types/ci/pipeline_schedule_variable_type_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Types::Ci::PipelineScheduleVariableType do
+RSpec.describe Types::Ci::PipelineScheduleVariableType, feature_category: :continuous_integration do
specify { expect(described_class.graphql_name).to eq('PipelineScheduleVariable') }
specify { expect(described_class.interfaces).to contain_exactly(Types::Ci::VariableInterface) }
specify { expect(described_class).to require_graphql_authorizations(:read_pipeline_schedule_variables) }
diff --git a/spec/graphql/types/ci/pipeline_type_spec.rb b/spec/graphql/types/ci/pipeline_type_spec.rb
index 5683b3f86c4..67209874b54 100644
--- a/spec/graphql/types/ci/pipeline_type_spec.rb
+++ b/spec/graphql/types/ci/pipeline_type_spec.rb
@@ -20,7 +20,7 @@ RSpec.describe Types::Ci::PipelineType do
if Gitlab.ee?
expected_fields += %w[
security_report_summary security_report_findings security_report_finding
- code_quality_reports dast_profile
+ code_quality_reports dast_profile code_quality_report_summary
]
end
diff --git a/spec/graphql/types/ci/runner_architecture_type_spec.rb b/spec/graphql/types/ci/runner_architecture_type_spec.rb
index 60709acfd53..58ec73323c6 100644
--- a/spec/graphql/types/ci/runner_architecture_type_spec.rb
+++ b/spec/graphql/types/ci/runner_architecture_type_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Types::Ci::RunnerArchitectureType do
+RSpec.describe Types::Ci::RunnerArchitectureType, feature_category: :runner do
specify { expect(described_class.graphql_name).to eq('RunnerArchitecture') }
it 'exposes the expected fields' do
diff --git a/spec/graphql/types/ci/runner_platform_type_spec.rb b/spec/graphql/types/ci/runner_platform_type_spec.rb
index 29b8e885183..1b0f5a5ec71 100644
--- a/spec/graphql/types/ci/runner_platform_type_spec.rb
+++ b/spec/graphql/types/ci/runner_platform_type_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Types::Ci::RunnerPlatformType do
+RSpec.describe Types::Ci::RunnerPlatformType, feature_category: :runner_fleet do
specify { expect(described_class.graphql_name).to eq('RunnerPlatform') }
it 'exposes the expected fields' do
diff --git a/spec/graphql/types/ci/runner_setup_type_spec.rb b/spec/graphql/types/ci/runner_setup_type_spec.rb
index 197e717e964..d3e47b52a80 100644
--- a/spec/graphql/types/ci/runner_setup_type_spec.rb
+++ b/spec/graphql/types/ci/runner_setup_type_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Types::Ci::RunnerSetupType do
+RSpec.describe Types::Ci::RunnerSetupType, feature_category: :runner_fleet do
specify { expect(described_class.graphql_name).to eq('RunnerSetup') }
it 'exposes the expected fields' do
diff --git a/spec/graphql/types/ci/runner_type_spec.rb b/spec/graphql/types/ci/runner_type_spec.rb
index b078d7f5fac..a2d107ae295 100644
--- a/spec/graphql/types/ci/runner_type_spec.rb
+++ b/spec/graphql/types/ci/runner_type_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe GitlabSchema.types['CiRunner'] do
+RSpec.describe GitlabSchema.types['CiRunner'], feature_category: :runner do
specify { expect(described_class.graphql_name).to eq('CiRunner') }
specify { expect(described_class).to require_graphql_authorizations(:read_runner) }
@@ -13,6 +13,7 @@ RSpec.describe GitlabSchema.types['CiRunner'] do
version short_sha revision locked run_untagged ip_address runner_type tag_list
project_count job_count admin_url edit_admin_url user_permissions executor_name architecture_name platform_name
maintenance_note maintenance_note_html groups projects jobs token_expires_at owner_project job_execution_status
+ ephemeral_authentication_token
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/ci/runner_upgrade_status_enum_spec.rb b/spec/graphql/types/ci/runner_upgrade_status_enum_spec.rb
index ef378f3fc5a..4aa9ad094a6 100644
--- a/spec/graphql/types/ci/runner_upgrade_status_enum_spec.rb
+++ b/spec/graphql/types/ci/runner_upgrade_status_enum_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Types::Ci::RunnerUpgradeStatusEnum do
+RSpec.describe Types::Ci::RunnerUpgradeStatusEnum, feature_category: :runner_fleet do
let(:model_only_enum_values) { %w[not_processed] }
let(:expected_graphql_source_values) do
Ci::RunnerVersion.statuses.keys - model_only_enum_values
@@ -15,6 +15,7 @@ RSpec.describe Types::Ci::RunnerUpgradeStatusEnum do
expected_graphql_source_values
.map(&:upcase)
.map { |v| v == 'INVALID_VERSION' ? 'INVALID' : v }
+ .map { |v| v == 'UNAVAILABLE' ? 'NOT_AVAILABLE' : v }
)
end
diff --git a/spec/graphql/types/ci/runner_web_url_edge_spec.rb b/spec/graphql/types/ci/runner_web_url_edge_spec.rb
index 08718df0a5b..07a9655b3e1 100644
--- a/spec/graphql/types/ci/runner_web_url_edge_spec.rb
+++ b/spec/graphql/types/ci/runner_web_url_edge_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Types::Ci::RunnerWebUrlEdge do
+RSpec.describe Types::Ci::RunnerWebUrlEdge, feature_category: :runner_fleet do
specify { expect(described_class.graphql_name).to eq('RunnerWebUrlEdge') }
it 'contains URL attributes' do
diff --git a/spec/graphql/types/ci/variable_sort_enum_spec.rb b/spec/graphql/types/ci/variable_sort_enum_spec.rb
new file mode 100644
index 00000000000..1702360a21f
--- /dev/null
+++ b/spec/graphql/types/ci/variable_sort_enum_spec.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::Ci::VariableSortEnum, feature_category: :pipeline_authoring do
+ it 'exposes the available order methods' do
+ expect(described_class.values).to match(
+ 'KEY_ASC' => have_attributes(value: :key_asc),
+ 'KEY_DESC' => have_attributes(value: :key_desc)
+ )
+ 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 cb7ce19c9fc..a0d99f5f0c1 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
+ MULTIPLE_SIGNATURES REVOKED_KEY
])
end
end
diff --git a/spec/graphql/types/group_type_spec.rb b/spec/graphql/types/group_type_spec.rb
index 0b65778ce90..6820cf2738e 100644
--- a/spec/graphql/types/group_type_spec.rb
+++ b/spec/graphql/types/group_type_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe GitlabSchema.types['Group'] do
dependency_proxy_image_prefix dependency_proxy_image_ttl_policy
shared_runners_setting timelogs organization_state_counts organizations
contact_state_counts contacts work_item_types
- recent_issue_boards ci_variables
+ recent_issue_boards ci_variables releases
]
expect(described_class).to include_graphql_fields(*expected_fields)
@@ -70,6 +70,13 @@ RSpec.describe GitlabSchema.types['Group'] do
it { is_expected.to have_graphql_resolver(Resolvers::Crm::OrganizationStateCountsResolver) }
end
+ describe 'releases field' do
+ subject { described_class.fields['releases'] }
+
+ it { is_expected.to have_graphql_type(Types::ReleaseType.connection_type) }
+ it { is_expected.to have_graphql_resolver(Resolvers::GroupReleasesResolver) }
+ end
+
it_behaves_like 'a GraphQL type with labels' do
let(:labels_resolver_arguments) { [:search_term, :includeAncestorGroups, :includeDescendantGroups, :onlyGroupLabels] }
end
diff --git a/spec/graphql/types/issue_type_spec.rb b/spec/graphql/types/issue_type_spec.rb
index 498625dc642..7c6cf137a1e 100644
--- a/spec/graphql/types/issue_type_spec.rb
+++ b/spec/graphql/types/issue_type_spec.rb
@@ -228,29 +228,17 @@ RSpec.describe GitlabSchema.types['Issue'] do
subject { GitlabSchema.execute(query, context: { current_user: admin }).as_json }
- context 'when `ban_user_feature_flag` is enabled' do
- context 'when issue is hidden' do
- it 'returns `true`' do
- expect(subject.dig('data', 'project', 'issue', 'hidden')).to eq(true)
- end
- end
-
- context 'when issue is visible' do
- let(:issue) { visible_issue }
-
- it 'returns `false`' do
- expect(subject.dig('data', 'project', 'issue', 'hidden')).to eq(false)
- end
+ context 'when issue is hidden' do
+ it 'returns `true`' do
+ expect(subject.dig('data', 'project', 'issue', 'hidden')).to eq(true)
end
end
- context 'when `ban_user_feature_flag` is disabled' do
- before do
- stub_feature_flags(ban_user_feature_flag: false)
- end
+ context 'when issue is visible' do
+ let(:issue) { visible_issue }
- it 'returns `nil`' do
- expect(subject.dig('data', 'project', 'issue', 'hidden')).to be_nil
+ it 'returns `false`' do
+ expect(subject.dig('data', 'project', 'issue', 'hidden')).to eq(false)
end
end
end
diff --git a/spec/graphql/types/notes/deleted_note_type_spec.rb b/spec/graphql/types/notes/deleted_note_type_spec.rb
new file mode 100644
index 00000000000..70985484e75
--- /dev/null
+++ b/spec/graphql/types/notes/deleted_note_type_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['DeletedNote'], feature_category: :team_planning do
+ it 'exposes the expected fields' do
+ expected_fields = %i[
+ id
+ discussion_id
+ last_discussion_note
+ ]
+
+ expect(described_class).to have_graphql_fields(*expected_fields).only
+ end
+end
diff --git a/spec/graphql/types/packages/package_details_type_spec.rb b/spec/graphql/types/packages/package_details_type_spec.rb
index d5688fc64c5..e4fe53f7660 100644
--- a/spec/graphql/types/packages/package_details_type_spec.rb
+++ b/spec/graphql/types/packages/package_details_type_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe GitlabSchema.types['PackageDetailsType'] do
it 'includes all the package fields' do
expected_fields = %w[
id name version created_at updated_at package_type tags project
- pipelines versions package_files dependency_links
+ pipelines versions package_files dependency_links public_package
npm_url maven_url conan_url nuget_url pypi_url pypi_setup_url
composer_url composer_config_repository_url
]
diff --git a/spec/graphql/types/permission_types/merge_request_spec.rb b/spec/graphql/types/permission_types/merge_request_spec.rb
index 2849dead9a8..2c5da9a933c 100644
--- a/spec/graphql/types/permission_types/merge_request_spec.rb
+++ b/spec/graphql/types/permission_types/merge_request_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe Types::PermissionTypes::MergeRequest do
:read_merge_request, :admin_merge_request, :update_merge_request,
:create_note, :push_to_source_branch, :remove_source_branch,
:cherry_pick_on_current_merge_request, :revert_on_current_merge_request,
- :can_merge
+ :can_merge, :can_approve
]
expect(described_class).to have_graphql_fields(expected_permissions)
diff --git a/spec/graphql/types/permission_types/work_item_spec.rb b/spec/graphql/types/permission_types/work_item_spec.rb
index e604ce5d6e0..db6d78b1538 100644
--- a/spec/graphql/types/permission_types/work_item_spec.rb
+++ b/spec/graphql/types/permission_types/work_item_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Types::PermissionTypes::WorkItem do
it do
expected_permissions = [
- :read_work_item, :update_work_item, :delete_work_item
+ :read_work_item, :update_work_item, :delete_work_item, :admin_work_item
]
expected_permissions.each do |permission|
diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb
index 4151789372b..7f26190830e 100644
--- a/spec/graphql/types/project_type_spec.rb
+++ b/spec/graphql/types/project_type_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['Project'] do
include GraphqlHelpers
+ include ProjectForksHelper
specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Project) }
@@ -37,7 +38,7 @@ RSpec.describe GitlabSchema.types['Project'] do
ci_template timelogs merge_commit_template squash_commit_template work_item_types
recent_issue_boards ci_config_path_or_default packages_cleanup_policy ci_variables
timelog_categories fork_targets branch_rules ci_config_variables pipeline_schedules languages
- incident_management_timeline_event_tags
+ incident_management_timeline_event_tags visible_forks
]
expect(described_class).to include_graphql_fields(*expected_fields)
@@ -285,6 +286,17 @@ RSpec.describe GitlabSchema.types['Project'] do
end
end
end
+
+ context 'with empty repository' do
+ let_it_be(:project) { create(:project_empty_repo) }
+
+ it 'raises an error' do
+ expect(subject['errors'][0]['message']).to eq('You must <a target="_blank" rel="noopener noreferrer" ' \
+ 'href="http://localhost/help/user/project/repository/index.md#' \
+ 'add-files-to-a-repository">add at least one file to the ' \
+ 'repository</a> before using Security features.')
+ end
+ end
end
describe 'issue field' do
@@ -848,4 +860,54 @@ RSpec.describe GitlabSchema.types['Project'] do
end
end
end
+
+ describe 'visible_forks' do
+ let_it_be(:user) { create(:user) }
+ let_it_be(:project) { create(:project, :public) }
+ let_it_be(:fork_reporter) { fork_project(project, nil, { repository: true }) }
+ let_it_be(:fork_developer) { fork_project(project, nil, { repository: true }) }
+ let_it_be(:fork_group_developer) { fork_project(project, nil, { repository: true }) }
+ let_it_be(:fork_public) { fork_project(project, nil, { repository: true }) }
+ let_it_be(:fork_private) { fork_project(project, nil, { repository: true }) }
+
+ let(:minimum_access_level) { '' }
+ let(:query) do
+ %(
+ query {
+ project(fullPath: "#{project.full_path}") {
+ visibleForks#{minimum_access_level} {
+ nodes {
+ fullPath
+ }
+ }
+ }
+ }
+ )
+ end
+
+ let(:forks) do
+ subject.dig('data', 'project', 'visibleForks', 'nodes')
+ end
+
+ subject { GitlabSchema.execute(query, context: { current_user: user }).as_json }
+
+ before do
+ fork_reporter.add_reporter(user)
+ fork_developer.add_developer(user)
+ fork_group_developer.group.add_developer(user)
+ end
+
+ it 'contains all forks' do
+ expect(forks.count).to eq(5)
+ end
+
+ context 'with minimum_access_level DEVELOPER' do
+ let(:minimum_access_level) { '(minimumAccessLevel: DEVELOPER)' }
+
+ it 'contains forks with developer access' do
+ expect(forks).to contain_exactly(a_hash_including('fullPath' => fork_developer.full_path),
+a_hash_including('fullPath' => fork_group_developer.full_path))
+ end
+ end
+ end
end
diff --git a/spec/graphql/types/query_type_spec.rb b/spec/graphql/types/query_type_spec.rb
index f06759e30c8..100ecc94f35 100644
--- a/spec/graphql/types/query_type_spec.rb
+++ b/spec/graphql/types/query_type_spec.rb
@@ -2,49 +2,15 @@
require 'spec_helper'
-RSpec.describe GitlabSchema.types['Query'] do
+RSpec.describe GitlabSchema.types['Query'], feature_category: :shared do
+ include_context 'with FOSS query type fields'
+
it 'is called Query' do
expect(described_class.graphql_name).to eq('Query')
end
it 'has the expected fields' do
- expected_fields = [
- :board_list,
- :ci_application_settings,
- :ci_config,
- :ci_variables,
- :container_repository,
- :current_user,
- :design_management,
- :echo,
- :gitpod_enabled,
- :group,
- :issue,
- :issues,
- :jobs,
- :merge_request,
- :metadata,
- :milestone,
- :namespace,
- :package,
- :project,
- :projects,
- :query_complexity,
- :runner,
- :runner_platforms,
- :runner_setup,
- :runners,
- :snippets,
- :timelogs,
- :todo,
- :topics,
- :usage_trends_measurements,
- :user,
- :users,
- :work_item
- ]
-
- expect(described_class).to have_graphql_fields(*expected_fields).at_least
+ expect(described_class).to have_graphql_fields(*expected_foss_fields).at_least
end
describe 'namespace field' do
diff --git a/spec/graphql/types/user_type_spec.rb b/spec/graphql/types/user_type_spec.rb
index 45cb960cf20..a6b5d454b60 100644
--- a/spec/graphql/types/user_type_spec.rb
+++ b/spec/graphql/types/user_type_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe GitlabSchema.types['User'], feature_category: :users do
+RSpec.describe GitlabSchema.types['User'], feature_category: :user_profile do
specify { expect(described_class.graphql_name).to eq('User') }
specify do
@@ -46,6 +46,7 @@ RSpec.describe GitlabSchema.types['User'], feature_category: :users do
preferencesGitpodPath
profileEnableGitpodPath
savedReplies
+ savedReply
]
expect(described_class).to have_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/users/email_type_spec.rb b/spec/graphql/types/users/email_type_spec.rb
index fb484915428..107bbf81e98 100644
--- a/spec/graphql/types/users/email_type_spec.rb
+++ b/spec/graphql/types/users/email_type_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'spec_helper'
-RSpec.describe GitlabSchema.types['Email'], feature_category: :users do
+RSpec.describe GitlabSchema.types['Email'], feature_category: :user_profile do
it 'has the correct fields' do
expected_fields = [
:id,
diff --git a/spec/graphql/types/users/namespace_commit_email_type_spec.rb b/spec/graphql/types/users/namespace_commit_email_type_spec.rb
index ccab881676e..27e50f7285e 100644
--- a/spec/graphql/types/users/namespace_commit_email_type_spec.rb
+++ b/spec/graphql/types/users/namespace_commit_email_type_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'spec_helper'
-RSpec.describe GitlabSchema.types['NamespaceCommitEmail'], feature_category: :users do
+RSpec.describe GitlabSchema.types['NamespaceCommitEmail'], feature_category: :user_profile do
it 'has the correct fields' do
expected_fields = [
:id,
diff --git a/spec/graphql/types/work_item_type_spec.rb b/spec/graphql/types/work_item_type_spec.rb
index dded96fde3a..42d56598944 100644
--- a/spec/graphql/types/work_item_type_spec.rb
+++ b/spec/graphql/types/work_item_type_spec.rb
@@ -11,6 +11,7 @@ RSpec.describe GitlabSchema.types['WorkItem'] do
it 'has specific fields' do
fields = %i[
+ author
confidential
description
description_html