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-11-29 09:10:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-29 09:10:52 +0300
commit119f857be2d552567a1e187e60a3360a01954321 (patch)
tree22579580859af12a40af70ed04564b0ea60c4d71
parentc5925a0892e90bc773ec976e53bc02b9e5dde19d (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/graphql/types/merge_requests/mergeability_check_identifier_enum.rb2
-rw-r--r--app/services/merge_requests/mergeability/check_base_service.rb18
-rw-r--r--app/services/merge_requests/mergeability/check_broken_status_service.rb5
-rw-r--r--app/services/merge_requests/mergeability/check_ci_status_service.rb6
-rw-r--r--app/services/merge_requests/mergeability/check_conflict_status_service.rb5
-rw-r--r--app/services/merge_requests/mergeability/check_discussions_status_service.rb5
-rw-r--r--app/services/merge_requests/mergeability/check_draft_status_service.rb5
-rw-r--r--app/services/merge_requests/mergeability/check_open_status_service.rb5
-rw-r--r--app/services/merge_requests/mergeability/check_rebase_status_service.rb5
-rw-r--r--app/workers/merge_request_cleanup_refs_worker.rb2
-rw-r--r--db/docs/batched_background_migrations/backfill_admin_mode_scope_for_personal_access_tokens.yml4
-rw-r--r--db/post_migrate/20231128155514_finalize_backfill_admin_mode_scope_for_personal_access_tokens.rb21
-rw-r--r--db/schema_migrations/202311281555141
-rw-r--r--doc/api/graphql/reference/index.md22
-rw-r--r--doc/development/application_settings.md58
-rw-r--r--doc/development/feature_development.md1
-rw-r--r--doc/tutorials/update_commit_messages/index.md23
-rw-r--r--spec/frontend/groups/components/groups_spec.js13
-rw-r--r--spec/services/merge_requests/mergeability/check_base_service_spec.rb16
-rw-r--r--spec/services/merge_requests/mergeability/check_broken_status_service_spec.rb2
-rw-r--r--spec/services/merge_requests/mergeability/check_ci_status_service_spec.rb2
-rw-r--r--spec/services/merge_requests/mergeability/check_conflict_status_service_spec.rb2
-rw-r--r--spec/services/merge_requests/mergeability/check_discussions_status_service_spec.rb3
-rw-r--r--spec/services/merge_requests/mergeability/check_draft_status_service_spec.rb2
-rw-r--r--spec/services/merge_requests/mergeability/check_open_status_service_spec.rb2
-rw-r--r--spec/services/merge_requests/mergeability/check_rebase_status_service_spec.rb2
-rw-r--r--spec/support/shared_examples/services/mergeability_checks_service_shared_examples.rb11
27 files changed, 180 insertions, 63 deletions
diff --git a/app/graphql/types/merge_requests/mergeability_check_identifier_enum.rb b/app/graphql/types/merge_requests/mergeability_check_identifier_enum.rb
index ac25c98941c..d5e63d9c9ca 100644
--- a/app/graphql/types/merge_requests/mergeability_check_identifier_enum.rb
+++ b/app/graphql/types/merge_requests/mergeability_check_identifier_enum.rb
@@ -11,7 +11,7 @@ module Types
value identifier.upcase,
value: identifier,
- description: "Mergeability check identifier is #{identifier}."
+ description: check_class.description
end
end
end
diff --git a/app/services/merge_requests/mergeability/check_base_service.rb b/app/services/merge_requests/mergeability/check_base_service.rb
index b8a275b6c32..8f8ba812246 100644
--- a/app/services/merge_requests/mergeability/check_base_service.rb
+++ b/app/services/merge_requests/mergeability/check_base_service.rb
@@ -4,15 +4,21 @@ module MergeRequests
class CheckBaseService
attr_reader :merge_request, :params
+ class_attribute :identifier, :description
+
+ def self.identifier(new_identifier)
+ self.identifier = new_identifier
+ end
+
+ def self.description(new_description)
+ self.description = new_description
+ end
+
def initialize(merge_request:, params:)
@merge_request = merge_request
@params = params
end
- def self.identifier
- failure_reason
- end
-
def skip?
raise NotImplementedError
end
@@ -28,10 +34,6 @@ module MergeRequests
private
- def failure_reason
- self.class.failure_reason
- end
-
def success(**args)
Gitlab::MergeRequests::Mergeability::CheckResult
.success(payload: default_payload(args))
diff --git a/app/services/merge_requests/mergeability/check_broken_status_service.rb b/app/services/merge_requests/mergeability/check_broken_status_service.rb
index ae637b4e19d..d432375c423 100644
--- a/app/services/merge_requests/mergeability/check_broken_status_service.rb
+++ b/app/services/merge_requests/mergeability/check_broken_status_service.rb
@@ -2,9 +2,8 @@
module MergeRequests
module Mergeability
class CheckBrokenStatusService < CheckBaseService
- def self.failure_reason
- :broken_status
- end
+ identifier :broken_status
+ description 'Checks whether the merge request is broken'
def execute
if merge_request.broken?
diff --git a/app/services/merge_requests/mergeability/check_ci_status_service.rb b/app/services/merge_requests/mergeability/check_ci_status_service.rb
index 9c57e61b07d..5c1aaaaf885 100644
--- a/app/services/merge_requests/mergeability/check_ci_status_service.rb
+++ b/app/services/merge_requests/mergeability/check_ci_status_service.rb
@@ -1,10 +1,10 @@
# frozen_string_literal: true
+
module MergeRequests
module Mergeability
class CheckCiStatusService < CheckBaseService
- def self.failure_reason
- :ci_must_pass
- end
+ identifier :ci_must_pass
+ description 'Checks whether CI has passed'
def execute
return inactive unless merge_request.only_allow_merge_if_pipeline_succeeds?
diff --git a/app/services/merge_requests/mergeability/check_conflict_status_service.rb b/app/services/merge_requests/mergeability/check_conflict_status_service.rb
index c59b3efff31..b60bb0cecb5 100644
--- a/app/services/merge_requests/mergeability/check_conflict_status_service.rb
+++ b/app/services/merge_requests/mergeability/check_conflict_status_service.rb
@@ -3,9 +3,8 @@
module MergeRequests
module Mergeability
class CheckConflictStatusService < CheckBaseService
- def self.failure_reason
- :conflict
- end
+ identifier :conflict
+ description 'Checks whether the merge request has a conflict'
def execute
if merge_request.can_be_merged?
diff --git a/app/services/merge_requests/mergeability/check_discussions_status_service.rb b/app/services/merge_requests/mergeability/check_discussions_status_service.rb
index 45b6f64762b..baff557299d 100644
--- a/app/services/merge_requests/mergeability/check_discussions_status_service.rb
+++ b/app/services/merge_requests/mergeability/check_discussions_status_service.rb
@@ -2,9 +2,8 @@
module MergeRequests
module Mergeability
class CheckDiscussionsStatusService < CheckBaseService
- def self.failure_reason
- :discussions_not_resolved
- end
+ identifier :discussions_not_resolved
+ description 'Checks whether the merge request has open discussions'
def execute
return inactive unless merge_request.only_allow_merge_if_all_discussions_are_resolved?
diff --git a/app/services/merge_requests/mergeability/check_draft_status_service.rb b/app/services/merge_requests/mergeability/check_draft_status_service.rb
index 5bd5c7ab305..fc0254ebe3f 100644
--- a/app/services/merge_requests/mergeability/check_draft_status_service.rb
+++ b/app/services/merge_requests/mergeability/check_draft_status_service.rb
@@ -3,9 +3,8 @@
module MergeRequests
module Mergeability
class CheckDraftStatusService < CheckBaseService
- def self.failure_reason
- :draft_status
- end
+ identifier :draft_status
+ description 'Checks whether the merge request is draft'
def execute
if merge_request.draft?
diff --git a/app/services/merge_requests/mergeability/check_open_status_service.rb b/app/services/merge_requests/mergeability/check_open_status_service.rb
index 587e7e7a08d..b9191a53ea3 100644
--- a/app/services/merge_requests/mergeability/check_open_status_service.rb
+++ b/app/services/merge_requests/mergeability/check_open_status_service.rb
@@ -3,9 +3,8 @@
module MergeRequests
module Mergeability
class CheckOpenStatusService < CheckBaseService
- def self.failure_reason
- :not_open
- end
+ identifier :not_open
+ description 'Checks whether the merge request is open'
def execute
if merge_request.open?
diff --git a/app/services/merge_requests/mergeability/check_rebase_status_service.rb b/app/services/merge_requests/mergeability/check_rebase_status_service.rb
index 99fa111643d..e3f003d9299 100644
--- a/app/services/merge_requests/mergeability/check_rebase_status_service.rb
+++ b/app/services/merge_requests/mergeability/check_rebase_status_service.rb
@@ -3,9 +3,8 @@
module MergeRequests
module Mergeability
class CheckRebaseStatusService < CheckBaseService
- def self.failure_reason
- :need_rebase
- end
+ identifier :need_rebase
+ description 'Checks whether the merge request needs to be rebased'
def execute
return inactive unless merge_request.project.ff_merge_must_be_possible?
diff --git a/app/workers/merge_request_cleanup_refs_worker.rb b/app/workers/merge_request_cleanup_refs_worker.rb
index db1a1e96997..36979e843ef 100644
--- a/app/workers/merge_request_cleanup_refs_worker.rb
+++ b/app/workers/merge_request_cleanup_refs_worker.rb
@@ -19,7 +19,7 @@ class MergeRequestCleanupRefsWorker
def perform_work
unless merge_request
- logger.error('No existing merge request to be cleaned up.')
+ logger.info('No existing merge request to be cleaned up.')
return
end
diff --git a/db/docs/batched_background_migrations/backfill_admin_mode_scope_for_personal_access_tokens.yml b/db/docs/batched_background_migrations/backfill_admin_mode_scope_for_personal_access_tokens.yml
index 33f3371e294..9309dd44980 100644
--- a/db/docs/batched_background_migrations/backfill_admin_mode_scope_for_personal_access_tokens.yml
+++ b/db/docs/batched_background_migrations/backfill_admin_mode_scope_for_personal_access_tokens.yml
@@ -1,6 +1,8 @@
---
migration_job_name: BackfillAdminModeScopeForPersonalAccessTokens
-description: backfills `admin_mode` scope to personal access tokens associated to administrators
+description: backfills `admin_mode` scope to personal access tokens associated to
+ administrators
feature_category: system_access
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/107875
milestone: 15.8
+finalized_by: '20231128155514'
diff --git a/db/post_migrate/20231128155514_finalize_backfill_admin_mode_scope_for_personal_access_tokens.rb b/db/post_migrate/20231128155514_finalize_backfill_admin_mode_scope_for_personal_access_tokens.rb
new file mode 100644
index 00000000000..ccdd9454081
--- /dev/null
+++ b/db/post_migrate/20231128155514_finalize_backfill_admin_mode_scope_for_personal_access_tokens.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class FinalizeBackfillAdminModeScopeForPersonalAccessTokens < Gitlab::Database::Migration[2.2]
+ milestone '16.7'
+
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'BackfillAdminModeScopeForPersonalAccessTokens',
+ table_name: :personal_access_tokens,
+ column_name: :id,
+ job_arguments: [],
+ finalize: true
+ )
+ end
+
+ def down; end
+end
diff --git a/db/schema_migrations/20231128155514 b/db/schema_migrations/20231128155514
new file mode 100644
index 00000000000..d60a1bda7d3
--- /dev/null
+++ b/db/schema_migrations/20231128155514
@@ -0,0 +1 @@
+bc075abab9ecb439ef71031a9ec5f38e5aa3c97310b1b221575bb64f042f81c7 \ No newline at end of file
diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md
index 8a60e4753f5..4a51ce36bef 100644
--- a/doc/api/graphql/reference/index.md
+++ b/doc/api/graphql/reference/index.md
@@ -30220,17 +30220,17 @@ Representation of mergeability check identifier.
| Value | Description |
| ----- | ----------- |
-| <a id="mergeabilitycheckidentifierbroken_status"></a>`BROKEN_STATUS` | Mergeability check identifier is broken_status. |
-| <a id="mergeabilitycheckidentifierci_must_pass"></a>`CI_MUST_PASS` | Mergeability check identifier is ci_must_pass. |
-| <a id="mergeabilitycheckidentifierconflict"></a>`CONFLICT` | Mergeability check identifier is conflict. |
-| <a id="mergeabilitycheckidentifierdiscussions_not_resolved"></a>`DISCUSSIONS_NOT_RESOLVED` | Mergeability check identifier is discussions_not_resolved. |
-| <a id="mergeabilitycheckidentifierdraft_status"></a>`DRAFT_STATUS` | Mergeability check identifier is draft_status. |
-| <a id="mergeabilitycheckidentifierjira_association_missing"></a>`JIRA_ASSOCIATION_MISSING` | Mergeability check identifier is jira_association_missing. |
-| <a id="mergeabilitycheckidentifiermerge_request_blocked"></a>`MERGE_REQUEST_BLOCKED` | Mergeability check identifier is merge_request_blocked. |
-| <a id="mergeabilitycheckidentifierneed_rebase"></a>`NEED_REBASE` | Mergeability check identifier is need_rebase. |
-| <a id="mergeabilitycheckidentifiernot_approved"></a>`NOT_APPROVED` | Mergeability check identifier is not_approved. |
-| <a id="mergeabilitycheckidentifiernot_open"></a>`NOT_OPEN` | Mergeability check identifier is not_open. |
-| <a id="mergeabilitycheckidentifierstatus_checks_must_pass"></a>`STATUS_CHECKS_MUST_PASS` | Mergeability check identifier is status_checks_must_pass. |
+| <a id="mergeabilitycheckidentifierbroken_status"></a>`BROKEN_STATUS` | Checks whether the merge request is broken. |
+| <a id="mergeabilitycheckidentifierci_must_pass"></a>`CI_MUST_PASS` | Checks whether CI has passed. |
+| <a id="mergeabilitycheckidentifierconflict"></a>`CONFLICT` | Checks whether the merge request has a conflict. |
+| <a id="mergeabilitycheckidentifierdiscussions_not_resolved"></a>`DISCUSSIONS_NOT_RESOLVED` | Checks whether the merge request has open discussions. |
+| <a id="mergeabilitycheckidentifierdraft_status"></a>`DRAFT_STATUS` | Checks whether the merge request is draft. |
+| <a id="mergeabilitycheckidentifierjira_association_missing"></a>`JIRA_ASSOCIATION_MISSING` | Checks whether the title or description references a Jira issue. |
+| <a id="mergeabilitycheckidentifiermerge_request_blocked"></a>`MERGE_REQUEST_BLOCKED` | Checks whether the merge request is blocked. |
+| <a id="mergeabilitycheckidentifierneed_rebase"></a>`NEED_REBASE` | Checks whether the merge request needs to be rebased. |
+| <a id="mergeabilitycheckidentifiernot_approved"></a>`NOT_APPROVED` | Checks whether the merge request is approved. |
+| <a id="mergeabilitycheckidentifiernot_open"></a>`NOT_OPEN` | Checks whether the merge request is open. |
+| <a id="mergeabilitycheckidentifierstatus_checks_must_pass"></a>`STATUS_CHECKS_MUST_PASS` | Checks whether the external status checks pass. |
### `MergeabilityCheckStatus`
diff --git a/doc/development/application_settings.md b/doc/development/application_settings.md
new file mode 100644
index 00000000000..835fd782633
--- /dev/null
+++ b/doc/development/application_settings.md
@@ -0,0 +1,58 @@
+---
+stage: none
+group: unassigned
+info: Any user with at least the Maintainer role can merge updates to this content. For details, see https://docs.gitlab.com/ee/development/development_processes.html#development-guidelines-review.
+---
+
+# Application settings development
+
+This document provides a development guide for contributors to add application
+settings to GitLab.
+
+Application settings are stored in the `application_settings` table. Each setting has its own column and there should only be one row.
+
+## Add a new application setting
+
+First of all, you have to decide if it is necessary to add an application setting.
+Consider our [configuration principles](https://about.gitlab.com/handbook/product/product-principles/#configuration-principles) when adding a new setting.
+
+To add a new setting, you have to:
+
+- Add a new column to the `application_settings` table.
+- Add the new setting to the [list of visible attributes](https://gitlab.com/gitlab-org/gitlab/-/blob/6f33ad46ffeac454c6c9ce92d6ba328a72f062fd/app/helpers/application_settings_helper.rb#L215).
+- Add the new setting to it to [`ApplicationSettingImplementation#defaults`](https://gitlab.com/gitlab-org/gitlab/-/blob/6f33ad46ffeac454c6c9ce92d6ba328a72f062fd/app/models/application_setting_implementation.rb#L36), if the setting has a default value.
+- Add a [test for the default value](https://gitlab.com/gitlab-org/gitlab/-/blob/6f33ad46ffeac454c6c9ce92d6ba328a72f062fd/spec/models/application_setting_spec.rb#L20), if the setting has a default value.
+- Add a validation for the new field to the [`ApplicationSetting` model](https://gitlab.com/gitlab-org/gitlab/-/blob/6f33ad46ffeac454c6c9ce92d6ba328a72f062fd/app/models/application_setting.rb).
+- Add a [model test](https://gitlab.com/gitlab-org/gitlab/-/blob/6f33ad46ffeac454c6c9ce92d6ba328a72f062fd/spec/models/application_setting_spec.rb) for the validation and default value
+- Find the [right view file](https://gitlab.com/gitlab-org/gitlab/-/tree/26ad8f4086c03283814bda50ff6e7043902cdbff/app/views/admin/application_settings) or create a new one and add a form field to the new setting.
+- Update the [API documentation](https://gitlab.com/gitlab-org/gitlab/-/blob/6f33ad46ffeac454c6c9ce92d6ba328a72f062fd/doc/api/settings.md). Application settings will automatically be available on the REST API.
+
+### Database migration example
+
+```ruby
+class AddNewSetting < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :application_settings, :new_setting, :text, if_not_exists: true
+ end
+
+ add_text_limit :application_settings, :new_setting, 255
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :application_settings, :new_setting, if_exists: true
+ end
+ end
+end
+```
+
+### Model validation example
+
+```ruby
+validates :new_setting,
+ length: { maximum: 255, message: N_('is too long (maximum is %{count} characters)') },
+ allow_blank: true
+```
diff --git a/doc/development/feature_development.md b/doc/development/feature_development.md
index b1acf3301e2..a5a6439b420 100644
--- a/doc/development/feature_development.md
+++ b/doc/development/feature_development.md
@@ -96,6 +96,7 @@ Consult these topics for information on contributing to specific GitLab features
- [Value Stream Analytics development guide](value_stream_analytics.md)
- [Application limits](application_limits.md)
- [AI features](ai_features/index.md)
+- [Application settings](application_settings.md)
### Import and Export
diff --git a/doc/tutorials/update_commit_messages/index.md b/doc/tutorials/update_commit_messages/index.md
index 76acba95e04..41d7444abed 100644
--- a/doc/tutorials/update_commit_messages/index.md
+++ b/doc/tutorials/update_commit_messages/index.md
@@ -4,20 +4,20 @@ group: Source Code
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
---
-# Tutorial: How to update Git commit messages **(FREE ALL)**
+# Tutorial: Update Git commit messages **(FREE ALL)**
Occasionally, after you've made a few commits to your branch, you realize you need
to update one or more commit messages. Perhaps you found a typo, or some automation warned you
that your commit message didn't completely align with a project's
[commit message guidelines](../../development/contributing/merge_request_workflow.md#commit-messages-guidelines).
-Updating the message can be tricky if you don't have much practice with using Git
+Updating the message can be tricky if you don't have much practice using Git
from the command-line interface (CLI). But don't worry, even if you have only ever worked in
-the GitLab UI, we'll walk you through the steps to use the CLI.
+the GitLab UI, you can follow these steps to use the CLI.
This tutorial explains how to rewrite commit messages in both cases:
-- If you work from just the GitLab UI, start at step 1.
+- If you work in the GitLab UI only, start at step 1.
- If you already have your repository cloned locally, you can skip to step 2.
To rewrite any number of commit messages:
@@ -44,14 +44,14 @@ You must have:
you should first verify with them that it's OK to update the commits. Some organizations might
have rules against rewriting commits, as it is considered a destructive change.
-You need to authenticate with GitLab to overwrite the commit messages in the final step.
+You must authenticate with GitLab to overwrite the commit messages in the final step.
If your GitLab account uses basic username and password authentication, you must have
[two factor authentication (2FA)](../../user/profile/account/two_factor_authentication.md)
disabled to authenticate from the CLI. Alternatively, you can [use an SSH key to authenticate with GitLab](../../user/ssh.md).
## Clone your repository to your local machine
-The first thing you need to do is get the repository on your local machine:
+The first step is to get a clone of the repository on your local machine:
1. In GitLab, on your project's overview page, on the top right, select **Clone**.
1. In the dropdown list, copy the URL for your repository by selecting **{copy-to-clipboard}** next to:
@@ -71,7 +71,7 @@ Now your repository is on your computer, ready for your Git CLI commands!
## Fetch and check out your branch
-Next we need to check out the branch that contains the commits to update.
+Next, you need to check out the branch that contains the commits to update.
1. Assuming you are still at the same place in the CLI as the previous step,
change to your project directory with `cd`:
@@ -99,9 +99,9 @@ Next we need to check out the branch that contains the commits to update.
## Update the commit messages
-Now we are ready to update the commit messages:
+Now you are ready to update the commit messages:
-1. In GitLab, see how far back in the commit history you need to go:
+1. In GitLab, check how far back in the commit history you need to go:
- If you already have a merge request open for your branch, you can check the
**Commits** tab and use the total number of commits.
@@ -158,7 +158,7 @@ Now we are ready to update the commit messages:
1. Save the edited text. Press <kbd>Escape</kbd> to exit `INSERT` mode,
then type `:wq` and <kbd>Enter</kbd> to save and exit.
-1. Git now goes through each commit one at a time and applies the commands we selected.
+1. Git now goes through each commit one at a time and applies the commands you selected.
Any commits with `pick` are added back to the branch unchanged. When Git reaches a commit
with `reword`, it stops and again opens up the text editor. Now it's time to finally update
the text of the commit message!
@@ -189,7 +189,8 @@ Now we are ready to update the commit messages:
Now all that's left is to push these changes up to GitLab:
-1. From the CLI, force push the changes to overwrite what exists in the branch in GitLab.
+1. From the CLI, push the changes back to GitLab. You must use the `-f` "force push" option,
+ because the commits were updated and a force push overwrites the old commits in GitLab.
```shell
git push -f origin
diff --git a/spec/frontend/groups/components/groups_spec.js b/spec/frontend/groups/components/groups_spec.js
index 3cdbd3e38be..33fd2681766 100644
--- a/spec/frontend/groups/components/groups_spec.js
+++ b/spec/frontend/groups/components/groups_spec.js
@@ -1,9 +1,7 @@
import Vue from 'vue';
import { GlEmptyState } from '@gitlab/ui';
-
-import { mountExtended } from 'helpers/vue_test_utils_helper';
+import { shallowMount } from '@vue/test-utils';
import GroupFolderComponent from '~/groups/components/group_folder.vue';
-import GroupItemComponent from 'jh_else_ce/groups/components/group_item.vue';
import PaginationLinks from '~/vue_shared/components/pagination_links.vue';
import GroupsComponent from '~/groups/components/groups.vue';
import eventHub from '~/groups/event_hub';
@@ -19,7 +17,7 @@ describe('GroupsComponent', () => {
};
const createComponent = ({ propsData } = {}) => {
- wrapper = mountExtended(GroupsComponent, {
+ wrapper = shallowMount(GroupsComponent, {
propsData: {
...defaultPropsData,
...propsData,
@@ -32,11 +30,6 @@ describe('GroupsComponent', () => {
const findPaginationLinks = () => wrapper.findComponent(PaginationLinks);
- beforeEach(() => {
- Vue.component('GroupFolder', GroupFolderComponent);
- Vue.component('GroupItem', GroupItemComponent);
- });
-
describe('methods', () => {
describe('change', () => {
it('should emit `fetchPage` event when page is changed via pagination', () => {
@@ -57,6 +50,8 @@ describe('GroupsComponent', () => {
});
describe('template', () => {
+ Vue.component('GroupFolder', GroupFolderComponent);
+
it('should render component template correctly', () => {
createComponent();
diff --git a/spec/services/merge_requests/mergeability/check_base_service_spec.rb b/spec/services/merge_requests/mergeability/check_base_service_spec.rb
index 806bde61c23..05f5b4f1315 100644
--- a/spec/services/merge_requests/mergeability/check_base_service_spec.rb
+++ b/spec/services/merge_requests/mergeability/check_base_service_spec.rb
@@ -8,6 +8,22 @@ RSpec.describe MergeRequests::Mergeability::CheckBaseService, feature_category:
let(:merge_request) { double }
let(:params) { double }
+ describe '.identifier' do
+ it 'sets the identifier' do
+ described_class.identifier("test")
+
+ expect(described_class.identifier).to eq("test")
+ end
+ end
+
+ describe '.description' do
+ it 'sets the description' do
+ described_class.description("test")
+
+ expect(described_class.description).to eq("test")
+ end
+ end
+
describe '#merge_request' do
it 'returns the merge_request' do
expect(check_base_service.merge_request).to eq merge_request
diff --git a/spec/services/merge_requests/mergeability/check_broken_status_service_spec.rb b/spec/services/merge_requests/mergeability/check_broken_status_service_spec.rb
index 7427ba938b6..f29289be86b 100644
--- a/spec/services/merge_requests/mergeability/check_broken_status_service_spec.rb
+++ b/spec/services/merge_requests/mergeability/check_broken_status_service_spec.rb
@@ -7,6 +7,8 @@ RSpec.describe MergeRequests::Mergeability::CheckBrokenStatusService, feature_ca
let(:merge_request) { build(:merge_request) }
+ it_behaves_like 'mergeability check service', :broken_status, 'Checks whether the merge request is broken'
+
describe '#execute' do
let(:result) { check_broken_status.execute }
diff --git a/spec/services/merge_requests/mergeability/check_ci_status_service_spec.rb b/spec/services/merge_requests/mergeability/check_ci_status_service_spec.rb
index 0373e2b63ef..aa7920b9b40 100644
--- a/spec/services/merge_requests/mergeability/check_ci_status_service_spec.rb
+++ b/spec/services/merge_requests/mergeability/check_ci_status_service_spec.rb
@@ -10,6 +10,8 @@ RSpec.describe MergeRequests::Mergeability::CheckCiStatusService, feature_catego
let(:params) { { skip_ci_check: skip_check } }
let(:skip_check) { false }
+ it_behaves_like 'mergeability check service', :ci_must_pass, 'Checks whether CI has passed'
+
describe '#execute' do
let(:result) { check_ci_status.execute }
diff --git a/spec/services/merge_requests/mergeability/check_conflict_status_service_spec.rb b/spec/services/merge_requests/mergeability/check_conflict_status_service_spec.rb
index 31594376119..e35de4d4042 100644
--- a/spec/services/merge_requests/mergeability/check_conflict_status_service_spec.rb
+++ b/spec/services/merge_requests/mergeability/check_conflict_status_service_spec.rb
@@ -7,6 +7,8 @@ RSpec.describe MergeRequests::Mergeability::CheckConflictStatusService, feature_
let(:merge_request) { build(:merge_request) }
+ it_behaves_like 'mergeability check service', :conflict, 'Checks whether the merge request has a conflict'
+
describe '#execute' do
let(:result) { check_conflict_status.execute }
diff --git a/spec/services/merge_requests/mergeability/check_discussions_status_service_spec.rb b/spec/services/merge_requests/mergeability/check_discussions_status_service_spec.rb
index 818dbbee050..3d1fe0c838d 100644
--- a/spec/services/merge_requests/mergeability/check_discussions_status_service_spec.rb
+++ b/spec/services/merge_requests/mergeability/check_discussions_status_service_spec.rb
@@ -10,6 +10,9 @@ RSpec.describe MergeRequests::Mergeability::CheckDiscussionsStatusService, featu
let(:params) { { skip_discussions_check: skip_check } }
let(:skip_check) { false }
+ it_behaves_like 'mergeability check service', :discussions_not_resolved,
+ 'Checks whether the merge request has open discussions'
+
describe '#execute' do
let(:result) { check_discussions_status.execute }
diff --git a/spec/services/merge_requests/mergeability/check_draft_status_service_spec.rb b/spec/services/merge_requests/mergeability/check_draft_status_service_spec.rb
index d2ed3b4be76..cef8169e725 100644
--- a/spec/services/merge_requests/mergeability/check_draft_status_service_spec.rb
+++ b/spec/services/merge_requests/mergeability/check_draft_status_service_spec.rb
@@ -10,6 +10,8 @@ RSpec.describe MergeRequests::Mergeability::CheckDraftStatusService, feature_cat
let(:params) { { skip_draft_check: skip_check } }
let(:skip_check) { false }
+ it_behaves_like 'mergeability check service', :draft_status, 'Checks whether the merge request is draft'
+
describe '#execute' do
let(:result) { check_draft_status.execute }
diff --git a/spec/services/merge_requests/mergeability/check_open_status_service_spec.rb b/spec/services/merge_requests/mergeability/check_open_status_service_spec.rb
index cc6ec4bf65a..f673e43931d 100644
--- a/spec/services/merge_requests/mergeability/check_open_status_service_spec.rb
+++ b/spec/services/merge_requests/mergeability/check_open_status_service_spec.rb
@@ -7,6 +7,8 @@ RSpec.describe MergeRequests::Mergeability::CheckOpenStatusService, feature_cate
let(:merge_request) { build(:merge_request) }
+ it_behaves_like 'mergeability check service', :not_open, 'Checks whether the merge request is open'
+
describe '#execute' do
let(:result) { check_open_status.execute }
diff --git a/spec/services/merge_requests/mergeability/check_rebase_status_service_spec.rb b/spec/services/merge_requests/mergeability/check_rebase_status_service_spec.rb
index f31b90cb2d8..047cf5c13bf 100644
--- a/spec/services/merge_requests/mergeability/check_rebase_status_service_spec.rb
+++ b/spec/services/merge_requests/mergeability/check_rebase_status_service_spec.rb
@@ -10,6 +10,8 @@ RSpec.describe MergeRequests::Mergeability::CheckRebaseStatusService, feature_ca
let(:params) { { skip_rebase_check: skip_check } }
let(:skip_check) { false }
+ it_behaves_like 'mergeability check service', :need_rebase, 'Checks whether the merge request needs to be rebased'
+
describe '#execute' do
let(:result) { check_rebase_status.execute }
diff --git a/spec/support/shared_examples/services/mergeability_checks_service_shared_examples.rb b/spec/support/shared_examples/services/mergeability_checks_service_shared_examples.rb
new file mode 100644
index 00000000000..56f9275b0aa
--- /dev/null
+++ b/spec/support/shared_examples/services/mergeability_checks_service_shared_examples.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'mergeability check service' do |identifier, description|
+ it 'sets the identifier' do
+ expect(described_class.identifier).to eq(identifier)
+ end
+
+ it 'sets the description' do
+ expect(described_class.description).to eq(description)
+ end
+end