diff options
Diffstat (limited to 'spec/graphql/types')
-rw-r--r-- | spec/graphql/types/ci/job_token_scope_type_spec.rb | 2 | ||||
-rw-r--r-- | spec/graphql/types/ci/job_type_spec.rb | 13 | ||||
-rw-r--r-- | spec/graphql/types/ci/pipeline_schedule_status_enum_spec.rb | 11 | ||||
-rw-r--r-- | spec/graphql/types/ci/pipeline_schedule_type_spec.rb | 30 | ||||
-rw-r--r-- | spec/graphql/types/environment_type_spec.rb | 4 | ||||
-rw-r--r-- | spec/graphql/types/namespace/package_settings_type_spec.rb | 20 | ||||
-rw-r--r-- | spec/graphql/types/packages/tag_type_spec.rb | 2 | ||||
-rw-r--r-- | spec/graphql/types/permission_types/ci/pipeline_schedule_type_spec.rb | 7 | ||||
-rw-r--r-- | spec/graphql/types/project_type_spec.rb | 16 | ||||
-rw-r--r-- | spec/graphql/types/projects/branch_rule_type_spec.rb (renamed from spec/graphql/types/branch_rule_type_spec.rb) | 3 | ||||
-rw-r--r-- | spec/graphql/types/subscription_type_spec.rb | 2 | ||||
-rw-r--r-- | spec/graphql/types/work_items/widgets/labels_update_input_type_spec.rb | 9 |
12 files changed, 99 insertions, 20 deletions
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 18f4d762d1e..569b59d6c70 100644 --- a/spec/graphql/types/ci/job_token_scope_type_spec.rb +++ b/spec/graphql/types/ci/job_token_scope_type_spec.rb @@ -12,7 +12,7 @@ RSpec.describe GitlabSchema.types['CiJobTokenScopeType'] do end describe 'query' do - let(:project) { create(:project, ci_job_token_scope_enabled: true).tap(&:save!) } + let(:project) { create(:project, ci_outbound_job_token_scope_enabled: true).tap(&:save!) } let_it_be(:current_user) { create(:user) } let(:query) do diff --git a/spec/graphql/types/ci/job_type_spec.rb b/spec/graphql/types/ci/job_type_spec.rb index b3dee082d1f..ce1558c4097 100644 --- a/spec/graphql/types/ci/job_type_spec.rb +++ b/spec/graphql/types/ci/job_type_spec.rb @@ -13,6 +13,7 @@ RSpec.describe Types::Ci::JobType do active allow_failure artifacts + browse_artifacts_path cancelable commitPath coverage @@ -64,4 +65,16 @@ RSpec.describe Types::Ci::JobType do is_expected.to eq("/#{project.full_path}/-/jobs/#{build.id}") end end + + describe '#browse_artifacts_path' do + subject { resolve_field(:browse_artifacts_path, build, current_user: user, object_type: described_class) } + + let_it_be(:project) { create(:project) } + let(:user) { create(:user) } + let(:build) { create(:ci_build, :artifacts, project: project, user: user) } + + it 'returns the path to browse the artifacts of the job' do + is_expected.to eq("/#{project.full_path}/-/jobs/#{build.id}/artifacts/browse") + end + end end diff --git a/spec/graphql/types/ci/pipeline_schedule_status_enum_spec.rb b/spec/graphql/types/ci/pipeline_schedule_status_enum_spec.rb new file mode 100644 index 00000000000..d271e72b17f --- /dev/null +++ b/spec/graphql/types/ci/pipeline_schedule_status_enum_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Types::Ci::PipelineScheduleStatusEnum do + specify { expect(described_class.graphql_name ).to eq('PipelineScheduleStatus') } + + it 'exposes the status of a pipeline schedule' do + expect(described_class.values.keys).to match_array(%w[ACTIVE INACTIVE]) + end +end diff --git a/spec/graphql/types/ci/pipeline_schedule_type_spec.rb b/spec/graphql/types/ci/pipeline_schedule_type_spec.rb new file mode 100644 index 00000000000..bf1413ef657 --- /dev/null +++ b/spec/graphql/types/ci/pipeline_schedule_type_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Types::Ci::PipelineScheduleType do + include GraphqlHelpers + + specify { expect(described_class.graphql_name).to eq('PipelineSchedule') } + specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Ci::PipelineSchedules) } + + it 'exposes the expected fields' do + expected_fields = %i[ + id + description + owner + active + lastPipeline + refForDisplay + refPath + forTag + nextRunAt + realNextRun + cron + cronTimezone + userPermissions + ] + + expect(described_class).to have_graphql_fields(*expected_fields) + end +end diff --git a/spec/graphql/types/environment_type_spec.rb b/spec/graphql/types/environment_type_spec.rb index ae58fe00af7..2605beac95a 100644 --- a/spec/graphql/types/environment_type_spec.rb +++ b/spec/graphql/types/environment_type_spec.rb @@ -5,13 +5,13 @@ require 'spec_helper' RSpec.describe GitlabSchema.types['Environment'] do specify { expect(described_class.graphql_name).to eq('Environment') } - it 'has the expected fields' do + it 'includes the expected fields' do expected_fields = %w[ name id state metrics_dashboard latest_opened_most_severe_alert path external_url deployments slug createdAt updatedAt autoStopAt autoDeleteAt tier environmentType lastDeployment ] - expect(described_class).to have_graphql_fields(*expected_fields) + expect(described_class).to include_graphql_fields(*expected_fields) end specify { expect(described_class).to require_graphql_authorizations(:read_environment) } diff --git a/spec/graphql/types/namespace/package_settings_type_spec.rb b/spec/graphql/types/namespace/package_settings_type_spec.rb index f63a0a7010f..5039f2d6153 100644 --- a/spec/graphql/types/namespace/package_settings_type_spec.rb +++ b/spec/graphql/types/namespace/package_settings_type_spec.rb @@ -14,4 +14,24 @@ RSpec.describe GitlabSchema.types['PackageSettings'] do it { is_expected.to have_graphql_type(Types::UntrustedRegexp) } end + + it 'includes package setting fields' do + expected_fields = %w[ + maven_duplicates_allowed + maven_duplicate_exception_regex + generic_duplicates_allowed + generic_duplicate_exception_regex + maven_package_requests_forwarding + lock_maven_package_requests_forwarding + npm_package_requests_forwarding + lock_npm_package_requests_forwarding + pypi_package_requests_forwarding + lock_pypi_package_requests_forwarding + maven_package_requests_forwarding_locked + npm_package_requests_forwarding_locked + pypi_package_requests_forwarding_locked + ] + + expect(described_class).to include_graphql_fields(*expected_fields) + end end diff --git a/spec/graphql/types/packages/tag_type_spec.rb b/spec/graphql/types/packages/tag_type_spec.rb index 83b705157d8..ea0801c7a0f 100644 --- a/spec/graphql/types/packages/tag_type_spec.rb +++ b/spec/graphql/types/packages/tag_type_spec.rb @@ -7,7 +7,7 @@ RSpec.describe GitlabSchema.types['PackageTag'] do it 'includes all the package tag fields' do expected_fields = %w[ - id name created_at updated_at + id name created_at updated_at ] expect(described_class).to include_graphql_fields(*expected_fields) diff --git a/spec/graphql/types/permission_types/ci/pipeline_schedule_type_spec.rb b/spec/graphql/types/permission_types/ci/pipeline_schedule_type_spec.rb new file mode 100644 index 00000000000..5929d22b202 --- /dev/null +++ b/spec/graphql/types/permission_types/ci/pipeline_schedule_type_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Types::Ci::PipelineScheduleType do + specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Ci::PipelineSchedules) } +end diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb index 617cbdb07fe..b435f3ed5ff 100644 --- a/spec/graphql/types/project_type_spec.rb +++ b/spec/graphql/types/project_type_spec.rb @@ -36,7 +36,7 @@ RSpec.describe GitlabSchema.types['Project'] do cluster_agent cluster_agents agent_configurations 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 + timelog_categories fork_targets branch_rules ci_config_variables pipeline_schedules ] expect(described_class).to include_graphql_fields(*expected_fields) @@ -508,20 +508,6 @@ RSpec.describe GitlabSchema.types['Project'] do it { is_expected.to have_graphql_resolver(Resolvers::Ci::JobTokenScopeResolver) } end - describe 'branch_rules field' do - subject { described_class.fields['branchRules'] } - - let(:br_resolver) { Resolvers::Projects::BranchRulesResolver } - - specify do - is_expected.to have_graphql_type( - Types::Projects::BranchRuleType.connection_type - ) - end - - specify { is_expected.to have_graphql_resolver(br_resolver) } - end - describe 'agent_configurations' do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } diff --git a/spec/graphql/types/branch_rule_type_spec.rb b/spec/graphql/types/projects/branch_rule_type_spec.rb index 277901f00bf..119ecf8a097 100644 --- a/spec/graphql/types/branch_rule_type_spec.rb +++ b/spec/graphql/types/projects/branch_rule_type_spec.rb @@ -10,6 +10,7 @@ RSpec.describe GitlabSchema.types['BranchRule'] do let(:fields) do %i[ name + isDefault branch_protection created_at updated_at @@ -18,5 +19,5 @@ RSpec.describe GitlabSchema.types['BranchRule'] do specify { is_expected.to require_graphql_authorizations(:read_protected_branch) } - specify { is_expected.to have_graphql_fields(fields) } + specify { is_expected.to have_graphql_fields(fields).at_least } end diff --git a/spec/graphql/types/subscription_type_spec.rb b/spec/graphql/types/subscription_type_spec.rb index 860cbbf0c15..c23a14deaf3 100644 --- a/spec/graphql/types/subscription_type_spec.rb +++ b/spec/graphql/types/subscription_type_spec.rb @@ -8,9 +8,11 @@ RSpec.describe GitlabSchema.types['Subscription'] do issuable_assignees_updated issue_crm_contacts_updated issuable_title_updated + issuable_description_updated issuable_labels_updated issuable_dates_updated merge_request_reviewers_updated + merge_request_merge_status_updated ] expect(described_class).to include_graphql_fields(*expected_fields) diff --git a/spec/graphql/types/work_items/widgets/labels_update_input_type_spec.rb b/spec/graphql/types/work_items/widgets/labels_update_input_type_spec.rb new file mode 100644 index 00000000000..3e5f40bde02 --- /dev/null +++ b/spec/graphql/types/work_items/widgets/labels_update_input_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ::Types::WorkItems::Widgets::LabelsUpdateInputType do + it { expect(described_class.graphql_name).to eq('WorkItemWidgetLabelsUpdateInput') } + + it { expect(described_class.arguments.keys).to contain_exactly('addLabelIds', 'removeLabelIds') } +end |