diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 18:40:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 18:40:28 +0300 |
commit | b595cb0c1dec83de5bdee18284abe86614bed33b (patch) | |
tree | 8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/graphql/types | |
parent | 2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff) |
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/graphql/types')
16 files changed, 78 insertions, 12 deletions
diff --git a/spec/graphql/types/ci/detailed_status_type_spec.rb b/spec/graphql/types/ci/detailed_status_type_spec.rb index 0c05227aec2..686461cb9a5 100644 --- a/spec/graphql/types/ci/detailed_status_type_spec.rb +++ b/spec/graphql/types/ci/detailed_status_type_spec.rb @@ -13,7 +13,7 @@ RSpec.describe Types::Ci::DetailedStatusType do :label, :text, :tooltip, :action) end - let_it_be(:stage) { create(:ci_stage_entity, status: :skipped) } + let_it_be(:stage) { create(:ci_stage, status: :skipped) } describe 'id field' do it 'correctly renders the field' do 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 43225b2089b..c1a3c4dd54d 100644 --- a/spec/graphql/types/ci/job_token_scope_type_spec.rb +++ b/spec/graphql/types/ci/job_token_scope_type_spec.rb @@ -38,7 +38,7 @@ RSpec.describe GitlabSchema.types['CiJobTokenScopeType'] do context 'with access to scope' do before do - project.add_user(current_user, :maintainer) + project.add_member(current_user, :maintainer) end context 'when multiple projects in the allow list' do @@ -46,7 +46,7 @@ RSpec.describe GitlabSchema.types['CiJobTokenScopeType'] do context 'when linked projects are readable' do before do - link.target_project.add_user(current_user, :developer) + link.target_project.add_member(current_user, :developer) end it 'returns readable projects in scope' do diff --git a/spec/graphql/types/ci/job_type_spec.rb b/spec/graphql/types/ci/job_type_spec.rb index 655c3636883..bc9e64282bc 100644 --- a/spec/graphql/types/ci/job_type_spec.rb +++ b/spec/graphql/types/ci/job_type_spec.rb @@ -23,6 +23,7 @@ RSpec.describe Types::Ci::JobType do id kind manual_job + manual_variables name needs pipeline @@ -33,6 +34,7 @@ RSpec.describe Types::Ci::JobType do refName refPath retryable + retried scheduledAt schedulingType shortSha diff --git a/spec/graphql/types/ci/runner_upgrade_status_type_enum_spec.rb b/spec/graphql/types/ci/runner_upgrade_status_type_enum_spec.rb index 81a852471b9..03c784dcbe7 100644 --- a/spec/graphql/types/ci/runner_upgrade_status_type_enum_spec.rb +++ b/spec/graphql/types/ci/runner_upgrade_status_type_enum_spec.rb @@ -3,11 +3,22 @@ require 'spec_helper' RSpec.describe Types::Ci::RunnerUpgradeStatusTypeEnum do + let(:model_only_enum_values) { %w[not_processed] } + let(:expected_graphql_source_values) do + Ci::RunnerVersion.statuses.keys - model_only_enum_values + end + specify { expect(described_class.graphql_name).to eq('CiRunnerUpgradeStatusType') } - it 'exposes all upgrade status values' do - expect(described_class.values.keys).to eq( - ['UNKNOWN'] + ::Gitlab::Ci::RunnerUpgradeCheck::STATUSES.map { |sym, _| sym.to_s.upcase } + it 'exposes all upgrade status values except not_processed' do + expect(described_class.values.keys).to match_array( + expected_graphql_source_values + .map(&:upcase) + .map { |v| v == 'INVALID_VERSION' ? 'INVALID' : v } ) end + + it 'exposes all upgrade status values except enum-only values' do + expect(described_class.values.values.map(&:value).map(&:to_s)).to match_array(expected_graphql_source_values) + end end diff --git a/spec/graphql/types/ci/status_action_type_spec.rb b/spec/graphql/types/ci/status_action_type_spec.rb index 4c467bf240e..3f4b52610ae 100644 --- a/spec/graphql/types/ci/status_action_type_spec.rb +++ b/spec/graphql/types/ci/status_action_type_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Types::Ci::StatusActionType do describe 'id field' do it 'correctly renders the field' do - stage = build(:ci_stage_entity, status: :skipped) + stage = build(:ci_stage, status: :skipped) status = stage.detailed_status(stage.pipeline.user) expected_id = "#{stage.class.name}-#{status.id}" diff --git a/spec/graphql/types/ci/variable_type_enum_spec.rb b/spec/graphql/types/ci/variable_type_enum_spec.rb new file mode 100644 index 00000000000..5604caebfff --- /dev/null +++ b/spec/graphql/types/ci/variable_type_enum_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe GitlabSchema.types['CiVariableType'] do + it 'matches the keys of Ci::Variable.variable_types' do + expect(described_class.values.keys).to contain_exactly('ENV_VAR', 'FILE') + end +end diff --git a/spec/graphql/types/ci/variable_type_spec.rb b/spec/graphql/types/ci/variable_type_spec.rb new file mode 100644 index 00000000000..a81e6adbab6 --- /dev/null +++ b/spec/graphql/types/ci/variable_type_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe GitlabSchema.types['CiVariable'] do + it 'contains attributes related to CI variables' do + expect(described_class).to have_graphql_fields( + :id, :key, :value, :variable_type, :protected, :masked, :raw, :environment_scope + ) + end +end diff --git a/spec/graphql/types/group_type_spec.rb b/spec/graphql/types/group_type_spec.rb index 82703948cea..69c7eaf111f 100644 --- a/spec/graphql/types/group_type_spec.rb +++ b/spec/graphql/types/group_type_spec.rb @@ -23,7 +23,7 @@ RSpec.describe GitlabSchema.types['Group'] do dependency_proxy_blob_count dependency_proxy_total_size dependency_proxy_image_prefix dependency_proxy_image_ttl_policy shared_runners_setting timelogs organizations contacts work_item_types - recent_issue_boards + recent_issue_boards ci_variables ] expect(described_class).to include_graphql_fields(*expected_fields) diff --git a/spec/graphql/types/issue_type_enum_spec.rb b/spec/graphql/types/issue_type_enum_spec.rb index 131e92aa5ed..8f4b6f3bf74 100644 --- a/spec/graphql/types/issue_type_enum_spec.rb +++ b/spec/graphql/types/issue_type_enum_spec.rb @@ -5,9 +5,9 @@ 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 except for task' do + it 'exposes all the existing issue type values' do expect(described_class.values.keys).to match_array( - %w[ISSUE INCIDENT TEST_CASE REQUIREMENT] + %w[ISSUE INCIDENT TEST_CASE REQUIREMENT TASK] ) end end diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb index 2e994bf7820..ed93d31da0f 100644 --- a/spec/graphql/types/project_type_spec.rb +++ b/spec/graphql/types/project_type_spec.rb @@ -36,7 +36,8 @@ RSpec.describe GitlabSchema.types['Project'] do pipeline_analytics squash_read_only sast_ci_configuration 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 + recent_issue_boards ci_config_path_or_default packages_cleanup_policy ci_variables + recent_issue_boards ci_config_path_or_default ci_variables ] expect(described_class).to include_graphql_fields(*expected_fields) diff --git a/spec/graphql/types/query_type_spec.rb b/spec/graphql/types/query_type_spec.rb index 8b8c44c10f6..514d24a209e 100644 --- a/spec/graphql/types/query_type_spec.rb +++ b/spec/graphql/types/query_type_spec.rb @@ -30,6 +30,7 @@ RSpec.describe GitlabSchema.types['Query'] do board_list topics gitpod_enabled + ci_variables ] expect(described_class).to have_graphql_fields(*expected_fields).at_least diff --git a/spec/graphql/types/release_type_spec.rb b/spec/graphql/types/release_type_spec.rb index 0c05a68c5a6..a1dc8850f94 100644 --- a/spec/graphql/types/release_type_spec.rb +++ b/spec/graphql/types/release_type_spec.rb @@ -11,7 +11,8 @@ RSpec.describe GitlabSchema.types['Release'] do description description_html name milestones evidences author commit assets links - created_at released_at + created_at released_at upcoming_release + historical_release ] expect(described_class).to include_graphql_fields(*expected_fields) diff --git a/spec/graphql/types/work_items/widget_interface_spec.rb b/spec/graphql/types/work_items/widget_interface_spec.rb index ee40bcc10ca..caf986c961f 100644 --- a/spec/graphql/types/work_items/widget_interface_spec.rb +++ b/spec/graphql/types/work_items/widget_interface_spec.rb @@ -17,6 +17,7 @@ RSpec.describe Types::WorkItems::WidgetInterface do where(:widget_class, :widget_type_name) do WorkItems::Widgets::Description | Types::WorkItems::Widgets::DescriptionType WorkItems::Widgets::Hierarchy | Types::WorkItems::Widgets::HierarchyType + WorkItems::Widgets::Assignees | Types::WorkItems::Widgets::AssigneesType end with_them do diff --git a/spec/graphql/types/work_items/widgets/assignees_type_spec.rb b/spec/graphql/types/work_items/widgets/assignees_type_spec.rb new file mode 100644 index 00000000000..816e66f1db1 --- /dev/null +++ b/spec/graphql/types/work_items/widgets/assignees_type_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Types::WorkItems::Widgets::AssigneesType do + it 'exposes the expected fields' do + expected_fields = %i[assignees allows_multiple_assignees can_invite_members type] + + expect(described_class).to have_graphql_fields(*expected_fields) + end +end diff --git a/spec/graphql/types/work_items/widgets/description_input_type_spec.rb b/spec/graphql/types/work_items/widgets/description_input_type_spec.rb new file mode 100644 index 00000000000..81c64bc38ab --- /dev/null +++ b/spec/graphql/types/work_items/widgets/description_input_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ::Types::WorkItems::Widgets::DescriptionInputType do + it { expect(described_class.graphql_name).to eq('WorkItemWidgetDescriptionInput') } + + it { expect(described_class.arguments.keys).to match_array(%w[description]) } +end diff --git a/spec/graphql/types/work_items/widgets/hierarchy_update_input_type_spec.rb b/spec/graphql/types/work_items/widgets/hierarchy_update_input_type_spec.rb new file mode 100644 index 00000000000..6221580605e --- /dev/null +++ b/spec/graphql/types/work_items/widgets/hierarchy_update_input_type_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ::Types::WorkItems::Widgets::HierarchyUpdateInputType do + it { expect(described_class.graphql_name).to eq('WorkItemWidgetHierarchyUpdateInput') } + + it { expect(described_class.arguments.keys).to match_array(%w[parentId childrenIds]) } +end |