diff --git a/doc/user/application_security/container_scanning/index.md b/doc/user/application_security/container_scanning/index.md
index 5d88eae7194..cba060d6ed8 100644
--- a/doc/user/application_security/container_scanning/index.md
+++ b/doc/user/application_security/container_scanning/index.md
@@ -83,7 +83,7 @@ To enable container scanning in your pipeline, you need the following:
- [GitLab Runner](https://docs.gitlab.com/runner/) with the [`docker`](https://docs.gitlab.com/runner/executors/docker.html)
or [`kubernetes`](https://docs.gitlab.com/runner/install/kubernetes.html) executor on Linux/amd64.
- Docker `18.09.03` or later installed on the same computer as the runner. If you're using the
- shared runners on GitLab.com, then this is already the case.
+ instance runners on GitLab.com, then this is already the case.
- An image matching the [supported distributions](#supported-distributions).
- [Build and push](../../packages/container_registry/build_and_push_images.md#use-gitlab-cicd)
the Docker image to your project's container registry.
diff --git a/doc/user/application_security/dast/browser/configuration/variables.md b/doc/user/application_security/dast/browser/configuration/variables.md
index 98c0748aa8d..30230fc457f 100644
--- a/doc/user/application_security/dast/browser/configuration/variables.md
+++ b/doc/user/application_security/dast/browser/configuration/variables.md
@@ -46,7 +46,7 @@ For authentication CI/CD variables, see [Authentication](authentication.md).
| `DAST_BROWSER_MAX_RESPONSE_SIZE_MB` | number | `15` | The maximum size of a HTTP response body. Responses with bodies larger than this are blocked by the browser. Defaults to 10 MB. |
| `DAST_BROWSER_NAVIGATION_STABILITY_TIMEOUT` | [Duration string](https://pkg.go.dev/time#ParseDuration) | `7s` | The maximum amount of time to wait for a browser to consider a page loaded and ready for analysis after a navigation completes. Defaults to `800ms`.|
| `DAST_BROWSER_NAVIGATION_TIMEOUT` | [Duration string](https://pkg.go.dev/time#ParseDuration) | `15s` | The maximum amount of time to wait for a browser to navigate from one page to another. |
-| `DAST_BROWSER_NUMBER_OF_BROWSERS` | number | `3` | The maximum number of concurrent browser instances to use. For shared runners on GitLab.com, we recommended a maximum of three. Private runners with more resources may benefit from a higher number, but are likely to produce little benefit after five to seven instances. |
+| `DAST_BROWSER_NUMBER_OF_BROWSERS` | number | `3` | The maximum number of concurrent browser instances to use. For instance runners on GitLab.com, we recommended a maximum of three. Private runners with more resources may benefit from a higher number, but are likely to produce little benefit after five to seven instances. |
| `DAST_BROWSER_PAGE_LOADING_SELECTOR` | selector | `css:#page-is-loading` | Selector that when is no longer visible on the page, indicates to the analyzer that the page has finished loading and the scan can continue. Cannot be used with `DAST_BROWSER_PAGE_READY_SELECTOR`. |
| `DAST_BROWSER_PAGE_READY_SELECTOR` | selector | `css:#page-is-ready` | Selector that when detected as visible on the page, indicates to the analyzer that the page has finished loading and the scan can continue. Cannot be used with `DAST_BROWSER_PAGE_LOADING_SELECTOR`. |
| `DAST_BROWSER_PASSIVE_CHECK_WORKERS` | int | `5` | Number of workers that passive scan in parallel. Recommend setting to the number of available CPUs. |
diff --git a/doc/user/crm/index.md b/doc/user/crm/index.md
index d552b540c89..557eebad1b0 100644
--- a/doc/user/crm/index.md
+++ b/doc/user/crm/index.md
@@ -34,9 +34,11 @@ For more information about what is planned for the future, see [issue 2256](http
## Enable customer relations management (CRM)
-Customer relations management features must be enabled at the group level. If your
+> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/108378) in GitLab 16.9.
+
+Customer relations management features are enabled at the group level. If your
group also contains subgroups, and you want to use CRM features in the subgroup,
-you must enable CRM features for the subgroup.
+CRM features must also be enabled for the subgroup.
To enable customer relations management in a group or subgroup:
diff --git a/doc/user/gitlab_com/index.md b/doc/user/gitlab_com/index.md
index 1feaa15e105..e49ddd68c81 100644
--- a/doc/user/gitlab_com/index.md
+++ b/doc/user/gitlab_com/index.md
@@ -264,7 +264,7 @@ from those IPs and allow them.
GitLab.com is fronted by Cloudflare. For incoming connections to GitLab.com, you might need to allow CIDR blocks of Cloudflare ([IPv4](https://www.cloudflare.com/ips-v4/) and [IPv6](https://www.cloudflare.com/ips-v6/)).
For outgoing connections from CI/CD runners, we are not providing static IP addresses.
-All GitLab.com shared runners are deployed into Google Cloud Platform (GCP) in `us-east1`.
+All GitLab.com instance runners are deployed into Google Cloud Platform (GCP) in `us-east1`.
Any IP-based firewall can be configured by looking up
[IP address ranges or CIDR blocks for GCP](https://cloud.google.com/compute/docs/faq#find_ip_range).
diff --git a/doc/user/group/access_and_permissions.md b/doc/user/group/access_and_permissions.md
index 33fea38633d..a725e6d6406 100644
--- a/doc/user/group/access_and_permissions.md
+++ b/doc/user/group/access_and_permissions.md
@@ -114,7 +114,7 @@ Keep in mind that restricting group access by IP address has the following impli
### GitLab.com access restrictions
-On GitLab.com shared runners are added to the [global allowlist](../../administration/settings/visibility_and_access_controls.md#configure-globally-allowed-ip-address-ranges), so that they are available regardless of IP restrictions.
+On GitLab.com instance runners are added to the [global allowlist](../../administration/settings/visibility_and_access_controls.md#configure-globally-allowed-ip-address-ranges), so that they are available regardless of IP restrictions.
Artifact and Registry downloading from runners is sourced from any Google or, in the case of MacOS runners, Amazon IP address in that region.
The download is therefore not added to the global allowlist.
diff --git a/doc/user/group/epics/index.md b/doc/user/group/epics/index.md
index e779a112b83..ad0f62a9518 100644
--- a/doc/user/group/epics/index.md
+++ b/doc/user/group/epics/index.md
@@ -35,7 +35,7 @@ Use epics:
The possible relationships between epics and issues are:
- An epic is the parent of one or more issues.
-- An epic is the parent of one or more child epics. For details see [Multi-level child epics](manage_epics.md#multi-level-child-epics).
+- An epic is the parent of one or more [child epics](manage_epics.md#multi-level-child-epics). Ultimate only.
```mermaid
graph TD
diff --git a/doc/user/packages/container_registry/index.md b/doc/user/packages/container_registry/index.md
index 4c5438ee1ad..55d0465901e 100644
--- a/doc/user/packages/container_registry/index.md
+++ b/doc/user/packages/container_registry/index.md
@@ -34,7 +34,7 @@ You can search, sort, filter, and [delete](delete_container_registry_images.md#u
your container images. You can share a filtered view by copying the URL from your browser.
Only members of the project or group can access the container registry for a private project.
-Container images downloaded from a private registry may be [available to other users in a shared runner](https://docs.gitlab.com/runner/security/index.html#usage-of-private-docker-images-with-if-not-present-pull-policy).
+Container images downloaded from a private registry may be [available to other users in an instance runner](https://docs.gitlab.com/runner/security/index.html#usage-of-private-docker-images-with-if-not-present-pull-policy).
If a project is public, the container registry is also public.
diff --git a/doc/user/packages/yarn_repository/index.md b/doc/user/packages/yarn_repository/index.md
index 6ef206c1a60..c40862a611f 100644
--- a/doc/user/packages/yarn_repository/index.md
+++ b/doc/user/packages/yarn_repository/index.md
@@ -29,7 +29,7 @@ achieve. For more information, review the [guidance on tokens](../../../user/pac
- If your organization uses two-factor authentication (2FA), you must use a
personal access token with the scope set to `api`.
- If you publish a package via CI/CD pipelines, you can use a CI job token in
- private runners or you can register a variable for shared runners.
+ private runners or you can register a variable for instance runners.
### Publish configuration
@@ -72,9 +72,9 @@ Your package should now publish to the package registry.
You can use pipeline variables when you use this method.
-You can use **Shared Runners** *(Default)* or **Private Runners** (Advanced).
+You can use **instance runners** *(Default)* or **Private Runners** (Advanced).
-#### Shared runners
+#### Instance runners
To create an authentication token for your project or group:
diff --git a/doc/user/project/changelogs.md b/doc/user/project/changelogs.md
index 12681bd2594..655abff2d77 100644
--- a/doc/user/project/changelogs.md
+++ b/doc/user/project/changelogs.md
@@ -92,7 +92,7 @@ To generate the changelog:
and append your desired options. Some options include:
- `--config-file [string]`: The path to the changelog configuration file in your project's
- Git repository. Defaults to `.gitlab/changelog_config.yml`.
+ Git repository. This file must exist in your project's Git repository. Defaults to `.gitlab/changelog_config.yml`.
- Commit range:
- `--from [string]`: The start of the range of commits (as a SHA) to use for
generating the changelog. This commit itself isn't included in the changelog.
@@ -110,8 +110,8 @@ for definitions and usage.
## Customize the changelog output
-To customize the changelog output, edit the changelog configuration file. The default
-location for this configuration is `.gitlab/changelog_config.yml`. The file supports
+To customize the changelog output, edit the changelog configuration file, and commit these changes to your project's Git repository.
+The default location for this configuration is `.gitlab/changelog_config.yml`. The file supports
these variables:
- `date_format`: The date format, in `strftime` format, used in the title of the newly added changelog data.
diff --git a/doc/user/project/clusters/cluster_access.md b/doc/user/project/clusters/cluster_access.md
index 40961357cb7..6187e1e2168 100644
--- a/doc/user/project/clusters/cluster_access.md
+++ b/doc/user/project/clusters/cluster_access.md
@@ -92,5 +92,5 @@ arbitrary images as they effectively have root access.
If you don't want to use a runner in privileged mode, either:
-- Use shared runners on GitLab.com. They don't have this security issue.
+- Use instance runners on GitLab.com. They don't have this security issue.
- Set up your own runners that use [`docker+machine`](https://docs.gitlab.com/runner/executors/docker_machine.html).
diff --git a/doc/user/project/pages/introduction.md b/doc/user/project/pages/introduction.md
index 0082040c28d..066a5f7f97b 100644
--- a/doc/user/project/pages/introduction.md
+++ b/doc/user/project/pages/introduction.md
@@ -35,7 +35,7 @@ If you are using [GitLab Pages on GitLab.com](#gitlab-pages-on-gitlabcom) to hos
- The domain name for GitLab Pages on GitLab.com is `gitlab.io`.
- Custom domains and TLS support are enabled.
-- Shared runners are enabled by default, provided for free and can be used to
+- Instance runners are enabled by default, provided for free and can be used to
build your website. If you want you can still bring your own runner.
## Example projects
diff --git a/doc/user/project/repository/forking_workflow.md b/doc/user/project/repository/forking_workflow.md
index 7eda7658976..8a57c226876 100644
--- a/doc/user/project/repository/forking_workflow.md
+++ b/doc/user/project/repository/forking_workflow.md
@@ -225,8 +225,8 @@ to share objects with another repository:
### Error: `An error occurred while forking the project. Please try again`
-This error can be due to a mismatch in shared runner settings between the forked project
-and the new namespace. See [Forks](../../../ci/runners/configure_runners.md#using-shared-runners-in-forked-projects)
+This error can be due to a mismatch in instance runner settings between the forked project
+and the new namespace. See [Forks](../../../ci/runners/configure_runners.md#using-instance-runners-in-forked-projects)
in the Runner documentation for more information.
### Removing fork relationship fails
diff --git a/doc/user/project/settings/import_export_troubleshooting.md b/doc/user/project/settings/import_export_troubleshooting.md
index 3f2b9a23f2d..35cf86b3ea0 100644
--- a/doc/user/project/settings/import_export_troubleshooting.md
+++ b/doc/user/project/settings/import_export_troubleshooting.md
@@ -28,12 +28,12 @@ tail /var/log/gitlab/gitlab-rails/importer.log
## Project fails to import due to mismatch
-If the [shared runners enablement](../../../ci/runners/runners_scope.md#enable-shared-runners-for-a-project)
+If the [instance runners enablement](../../../ci/runners/runners_scope.md#enable-instance-runners-for-a-project)
does not match between the exported project, and the project import, the project fails to import.
Review [issue 276930](https://gitlab.com/gitlab-org/gitlab/-/issues/276930), and either:
-- Ensure shared runners are enabled in both the source and destination projects.
-- Disable shared runners on the parent group when you import the project.
+- Ensure instance runners are enabled in both the source and destination projects.
+- Disable instance runners on the parent group when you import the project.
## Users missing from imported project
diff --git a/lib/bulk_imports/ndjson_pipeline.rb b/lib/bulk_imports/ndjson_pipeline.rb
index 07118c3b55c..e817bfe8034 100644
--- a/lib/bulk_imports/ndjson_pipeline.rb
+++ b/lib/bulk_imports/ndjson_pipeline.rb
@@ -136,7 +136,8 @@ module BulkImports
pipeline_class: tracker.pipeline_name,
exception_class: 'RecordInvalid',
exception_message: record.errors.full_messages.to_sentence,
- correlation_id_value: Labkit::Correlation::CorrelationId.current_or_new_id
+ correlation_id_value: Labkit::Correlation::CorrelationId.current_or_new_id,
+ subrelation: record.class.to_s
)
end
end
diff --git a/lib/gitlab/database/partitioning/list/convert_table.rb b/lib/gitlab/database/partitioning/list/convert_table.rb
index 8819c916ce6..41df83e4d2f 100644
--- a/lib/gitlab/database/partitioning/list/convert_table.rb
+++ b/lib/gitlab/database/partitioning/list/convert_table.rb
@@ -200,7 +200,7 @@ module Gitlab
end
def attach_foreign_keys_to_parent
- migration_context.foreign_keys(table_name).each do |fk|
+ Gitlab::Database::PostgresForeignKey.by_constrained_table_name(table_name).not_inherited.each do |fk|
# At this point no other connection knows about the parent table.
# Thus the only contended lock in the following transaction is on fk.to_table.
# So a deadlock is impossible.
@@ -209,14 +209,22 @@ module Gitlab
# If we're rerunning this migration after a failure to acquire a lock, the foreign key might already exist
# Don't try to recreate it in that case
- if migration_context.foreign_keys(parent_table_name)
- .any? { |p_fk| p_fk.options[:name] == fk.options[:name] }
- next
- end
+ next if Gitlab::Database::PostgresForeignKey
+ .by_constrained_table_name(parent_table_name)
+ .not_inherited
+ .any? { |p_fk| p_fk.name == fk.name }
- migration_context.with_lock_retries(raise_on_exhaustion: true) do
- migration_context.add_foreign_key(parent_table_name, fk.to_table, **fk.options)
- end
+ migration_context.add_concurrent_foreign_key(
+ parent_table_name,
+ fk.referenced_table_name,
+ name: fk.name,
+ column: fk.constrained_columns,
+ target_column: fk.referenced_columns,
+ on_delete: fk.on_delete_action == "no_action" ? nil : fk.on_delete_action.to_sym,
+ on_update: fk.on_update_action == "no_action" ? nil : fk.on_update_action.to_sym,
+ validate: true,
+ allow_partitioned: true
+ )
end
end
diff --git a/lib/gitlab/import_export/project/import_export.yml b/lib/gitlab/import_export/project/import_export.yml
index d34cab5ac92..f42cd37b00d 100644
--- a/lib/gitlab/import_export/project/import_export.yml
+++ b/lib/gitlab/import_export/project/import_export.yml
@@ -1233,6 +1233,7 @@ ee:
- :commit_committer_check
- :regexp_uses_re2
- :reject_non_dco_commits
+ - :organization
unprotect_access_levels:
- :access_level
- :user_id
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 58c95b96840..cf4e5b3ae86 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -2728,6 +2728,9 @@ msgstr ""
msgid "Achievements|Awarded %{timeAgo} by a private namespace"
msgstr ""
+msgid "Achievements|There are currently no achievements."
+msgstr ""
+
msgid "Achievements|View your achievements on your %{link_start}profile%{link_end}."
msgstr ""
@@ -39193,7 +39196,7 @@ msgstr ""
msgid "ProjectSettings|Storage name:"
msgstr ""
-msgid "ProjectSettings|Store custom configuration files."
+msgid "ProjectSettings|Store configuration files for custom dashboards and visualizations."
msgstr ""
msgid "ProjectSettings|Submit changes to be merged upstream."
@@ -39522,15 +39525,15 @@ msgstr ""
msgid "ProjectsNew|Create new project"
msgstr ""
-msgid "ProjectsNew|Default hashing algorithm is SHA-1."
-msgstr ""
-
msgid "ProjectsNew|Description format"
msgstr ""
msgid "ProjectsNew|Enable Static Application Security Testing (SAST)"
msgstr ""
+msgid "ProjectsNew|Experimental settings"
+msgstr ""
+
msgid "ProjectsNew|Group name"
msgstr ""
@@ -39546,6 +39549,9 @@ msgstr ""
msgid "ProjectsNew|Initialize repository with a README"
msgstr ""
+msgid "ProjectsNew|Might break existing functionality with other repositories or APIs. It's not possible to change SHA-256 repositories back to the default SHA-1 hashing algorithm."
+msgstr ""
+
msgid "ProjectsNew|Migrate your data from an external source like GitHub, Bitbucket, or another instance of GitLab."
msgstr ""
@@ -39588,7 +39594,7 @@ msgstr ""
msgid "ProjectsNew|Unable to suggest a path. Please refresh and try again."
msgstr ""
-msgid "ProjectsNew|Use SHA-256 as the repository hashing algorithm"
+msgid "ProjectsNew|Use SHA-256 for repository hashing algorithm"
msgstr ""
msgid "ProjectsNew|Visibility Level"
@@ -44370,6 +44376,9 @@ msgstr ""
msgid "SecurityConfiguration|Vulnerability details and statistics in the merge request"
msgstr ""
+msgid "SecurityOrchestraation|(Formerly Scan result policy)"
+msgstr ""
+
msgid "SecurityOrchestration| and "
msgstr ""
@@ -44891,6 +44900,12 @@ msgstr ""
msgid "SecurityOrchestration|Summary"
msgstr ""
+msgid "SecurityOrchestration|The %{oldNameStart}Scan result policy%{oldNameEnd} is now called the %{newNameStart}Merge request approval policy%{newNameEnd} to better align with its purpose. For more details, see the release notes."
+msgstr ""
+
+msgid "SecurityOrchestration|The Scan result policy is now called the Merge request approval policy to better align with its purpose. For more details, see the release notes."
+msgstr ""
+
msgid "SecurityOrchestration|The following branches do not exist on this development project: %{branches}. Please review all protected branches to ensure the values are accurate before updating this policy."
msgstr ""
@@ -44951,6 +44966,9 @@ msgstr ""
msgid "SecurityOrchestration|Update scan policies"
msgstr ""
+msgid "SecurityOrchestration|Updated policy name"
+msgstr ""
+
msgid "SecurityOrchestration|Use a merge request approval policy to create rules that check for security vulnerabilities and license compliance before merging a merge request."
msgstr ""
diff --git a/spec/components/pajamas/accordion_item_component_spec.rb b/spec/components/pajamas/accordion_item_component_spec.rb
new file mode 100644
index 00000000000..10aef4a44ad
--- /dev/null
+++ b/spec/components/pajamas/accordion_item_component_spec.rb
@@ -0,0 +1,59 @@
+# frozen_string_literal: true
+
+require "spec_helper"
+
+RSpec.describe Pajamas::AccordionItemComponent, type: :component, feature_category: :shared do
+ let(:title) { "This is a title" }
+ let(:content) { "This is the content" }
+ let(:state) { :opened }
+
+ before do
+ render_inline(described_class.new(title: title, state: state)) do |_c|
+ content
+ end
+ end
+
+ describe "title param" do
+ it "is shown inside the accordion" do
+ expect(page).to have_button(title)
+ end
+ end
+
+ describe "content" do
+ it "is shown inside the accordion" do
+ expect(page).to have_css ".accordion-item", text: content
+ end
+ end
+
+ describe "state (opened) param" do
+ it "renders the show class" do
+ expect(page).to have_selector('.show')
+ end
+
+ it "renders a chevron-down icon" do
+ expect(page).to have_selector('[data-testid="chevron-down-icon"]')
+ end
+
+ it "renders a button with the correct aria-expanded value" do
+ expect(page).to have_selector('button[aria-expanded="true"]')
+ end
+ end
+
+ describe "state (closed) param" do
+ before do
+ render_inline(described_class.new(title: title, state: :closed))
+ end
+
+ it "does not render the show class" do
+ expect(page).not_to have_selector('.show')
+ end
+
+ it "renders a chevron-right icon" do
+ expect(page).to have_selector('[data-testid="chevron-right-icon"]')
+ end
+
+ it "renders a button with the correct aria-expanded value" do
+ expect(page).to have_selector('button[aria-expanded="false"]')
+ end
+ end
+end
diff --git a/spec/components/previews/pajamas/accordion_component_preview.rb b/spec/components/previews/pajamas/accordion_component_preview.rb
new file mode 100644
index 00000000000..5c722cdee69
--- /dev/null
+++ b/spec/components/previews/pajamas/accordion_component_preview.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+module Pajamas
+ class AccordionComponentPreview < ViewComponent::Preview
+ # @param title text
+ # @param body text
+ # @param state
+ def default(title: "Accordion title (open)", body: "Accordion body", state: :opened)
+ render(Pajamas::AccordionComponent.new(
+ title: title,
+ body: body,
+ state: state
+ ))
+ end
+
+ def closed(title: "Accordion title (closed)", body: "Accordion body", state: :closed)
+ render(Pajamas::AccordionComponent.new(
+ title: title,
+ body: body,
+ state: state
+ ))
+ end
+ end
+end
diff --git a/spec/controllers/projects/autocomplete_sources_controller_spec.rb b/spec/controllers/projects/autocomplete_sources_controller_spec.rb
index 1745dfe3af0..22736655795 100644
--- a/spec/controllers/projects/autocomplete_sources_controller_spec.rb
+++ b/spec/controllers/projects/autocomplete_sources_controller_spec.rb
@@ -296,11 +296,7 @@ RSpec.describe Projects::AutocompleteSourcesController do
end
context 'when feature flag is enabled' do
- context 'when a group has contact relations enabled' do
- before do
- create(:crm_settings, group: group, enabled: true)
- end
-
+ context 'when a group has crm enabled' do
context 'when a user can read contacts' do
it 'lists contacts' do
group.add_developer(user)
@@ -321,7 +317,11 @@ RSpec.describe Projects::AutocompleteSourcesController do
end
end
- context 'when a group has contact relations disabled' do
+ context 'when a group has crm disabled' do
+ before do
+ create(:crm_settings, group: group, enabled: false)
+ end
+
it 'renders 404' do
group.add_developer(user)
diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb
index 9e479aa4558..2f671b08985 100644
--- a/spec/db/schema_spec.rb
+++ b/spec/db/schema_spec.rb
@@ -102,6 +102,7 @@ RSpec.describe 'Database schema', feature_category: :database do
p_batched_git_ref_updates_deletions: %w[project_id partition_id],
p_catalog_resource_sync_events: %w[catalog_resource_id project_id partition_id],
p_ci_finished_build_ch_sync_events: %w[build_id],
+ p_ci_job_artifacts: %w[partition_id project_id job_id],
p_ci_pipeline_variables: %w[partition_id],
product_analytics_events_experimental: %w[event_id txn_id user_id],
project_build_artifacts_size_refreshes: %w[last_job_artifact_id],
diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb
index 2f55c3ab567..e92e4768b8b 100644
--- a/spec/factories/groups.rb
+++ b/spec/factories/groups.rb
@@ -113,9 +113,9 @@ FactoryBot.define do
end
end
- trait :crm_enabled do
+ trait :crm_disabled do
after(:create) do |group|
- create(:crm_settings, group: group, enabled: true)
+ create(:crm_settings, group: group, enabled: false)
end
end
diff --git a/spec/features/groups/crm/contacts/create_spec.rb b/spec/features/groups/crm/contacts/create_spec.rb
index aa05ef82a8b..b0e10477018 100644
--- a/spec/features/groups/crm/contacts/create_spec.rb
+++ b/spec/features/groups/crm/contacts/create_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Create a CRM contact', :js, feature_category: :service_desk do
let(:user) { create(:user) }
- let(:group) { create(:group, :crm_enabled) }
+ let(:group) { create(:group) }
let!(:crm_organization) { create(:crm_organization, group: group, name: 'GitLab') }
before do
diff --git a/spec/features/groups/group_page_with_external_authorization_service_spec.rb b/spec/features/groups/group_page_with_external_authorization_service_spec.rb
index fe1a685899f..f69fec56d35 100644
--- a/spec/features/groups/group_page_with_external_authorization_service_spec.rb
+++ b/spec/features/groups/group_page_with_external_authorization_service_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe 'The group page', :js, feature_category: :groups_and_projects do
include ExternalAuthorizationServiceHelpers
let(:user) { create(:user) }
- let(:group) { create(:group) }
+ let(:group) { create(:group, :crm_disabled) }
before do
sign_in user
diff --git a/spec/features/groups/navbar_spec.rb b/spec/features/groups/navbar_spec.rb
index e9cdacf8255..b1d7559a6d9 100644
--- a/spec/features/groups/navbar_spec.rb
+++ b/spec/features/groups/navbar_spec.rb
@@ -17,6 +17,10 @@ RSpec.describe 'Group navbar', :with_license, :js, feature_category: :navigation
insert_after_nav_item(_('Analyze'), new_nav_item: settings_for_maintainer_nav_item) if Gitlab.ee?
insert_infrastructure_registry_nav(_('Kubernetes'))
+ if group.crm_enabled? && group.parent.nil?
+ insert_customer_relations_nav(Gitlab.ee? ? _('Iterations') : _('Milestones'))
+ end
+
stub_config(dependency_proxy: { enabled: false })
stub_config(registry: { enabled: false })
stub_group_wikis(false)
@@ -42,24 +46,18 @@ RSpec.describe 'Group navbar', :with_license, :js, feature_category: :navigation
it_behaves_like 'verified navigation bar'
end
- context 'when customer_relations feature is enabled' do
- let(:group) { create(:group, :crm_enabled) }
+ context 'when crm feature is disabled' do
+ let(:group) { create(:group, :crm_disabled) }
before do
- if Gitlab.ee?
- insert_customer_relations_nav(_('Iterations'))
- else
- insert_customer_relations_nav(_('Milestones'))
- end
-
visit group_path(group)
end
it_behaves_like 'verified navigation bar'
end
- context 'when customer_relations feature is enabled but subgroup' do
- let(:group) { create(:group, :crm_enabled, parent: create(:group)) }
+ context 'when crm feature is enabled but subgroup' do
+ let(:group) { create(:group, parent: create(:group)) }
before do
visit group_path(group)
diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb
index 58c84d26fea..409153a7725 100644
--- a/spec/features/issues/gfm_autocomplete_spec.rb
+++ b/spec/features/issues/gfm_autocomplete_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe 'GFM autocomplete', :js, feature_category: :team_planning do
let_it_be(:user) { create(:user, name: '💃speciąl someone💃', username: 'someone.special') }
let_it_be(:user2) { create(:user, name: 'Marge Simpson', username: 'msimpson') }
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
let_it_be(:issue) { create(:issue, project: project, assignees: [user]) }
let_it_be(:label) { create(:label, project: project, title: 'special+') }
diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb
index 08d0d54bcd2..ff1119af21f 100644
--- a/spec/features/issues/issue_sidebar_spec.rb
+++ b/spec/features/issues/issue_sidebar_spec.rb
@@ -48,7 +48,7 @@ RSpec.describe 'Issue Sidebar', feature_category: :team_planning do
open_assignees_dropdown
page.within '.dropdown-menu-user' do
- find('[data-testid="user-search-input"]').set(user2.name)
+ find_by_testid('user-search-input').set(user2.name)
wait_for_requests
@@ -68,7 +68,7 @@ RSpec.describe 'Issue Sidebar', feature_category: :team_planning do
it 'keeps your filtered term after filtering and dismissing the dropdown' do
open_assignees_dropdown
- find('[data-testid="user-search-input"]').set(user2.name)
+ find_by_testid('user-search-input').set(user2.name)
wait_for_requests
page.within '.dropdown-menu-user' do
@@ -84,7 +84,7 @@ RSpec.describe 'Issue Sidebar', feature_category: :team_planning do
expect(page.all('[data-testid="unselected-participant"]').length).to eq(1)
end
- expect(find('[data-testid="user-search-input"]').value).to eq(user2.name)
+ expect(find_by_testid('user-search-input').value).to eq(user2.name)
end
end
end
diff --git a/spec/features/issues/issue_state_spec.rb b/spec/features/issues/issue_state_spec.rb
index 125329764c6..b85d40a798d 100644
--- a/spec/features/issues/issue_state_spec.rb
+++ b/spec/features/issues/issue_state_spec.rb
@@ -16,14 +16,14 @@ RSpec.describe 'issue state', :js, feature_category: :team_planning do
it 'can close an issue' do
expect(page).to have_selector('[data-testid="issue-state-badge"]')
- expect(find('[data-testid="issue-state-badge"]')).to have_content 'Open'
+ expect(find_by_testid('issue-state-badge')).to have_content 'Open'
within selector do
click_button 'Close issue'
wait_for_requests
end
- expect(find('[data-testid="issue-state-badge"]')).to have_content 'Closed'
+ expect(find_by_testid('issue-state-badge')).to have_content 'Closed'
end
end
@@ -31,14 +31,14 @@ RSpec.describe 'issue state', :js, feature_category: :team_planning do
it 'can reopen an issue' do
expect(page).to have_selector('[data-testid="issue-state-badge"]')
- expect(find('[data-testid="issue-state-badge"]')).to have_content 'Closed'
+ expect(find_by_testid('issue-state-badge')).to have_content 'Closed'
within selector do
click_button 'Reopen issue'
wait_for_requests
end
- expect(find('[data-testid="issue-state-badge"]')).to have_content 'Open'
+ expect(find_by_testid('issue-state-badge')).to have_content 'Open'
end
end
diff --git a/spec/features/issues/user_creates_issue_spec.rb b/spec/features/issues/user_creates_issue_spec.rb
index a407e7fd112..01a14aaca75 100644
--- a/spec/features/issues/user_creates_issue_spec.rb
+++ b/spec/features/issues/user_creates_issue_spec.rb
@@ -101,7 +101,7 @@ RSpec.describe "User creates issue", feature_category: :team_planning do
wait_for_all_requests
- page.within '[data-testid="sidebar-labels"]' do
+ within_testid('sidebar-labels') do
click_button label_titles.first
click_button _('Close')
diff --git a/spec/features/issues/user_edits_issue_spec.rb b/spec/features/issues/user_edits_issue_spec.rb
index e9bf1ef542b..b3ac374ae63 100644
--- a/spec/features/issues/user_edits_issue_spec.rb
+++ b/spec/features/issues/user_edits_issue_spec.rb
@@ -117,7 +117,7 @@ RSpec.describe "Issues > User edits issue", :js, feature_category: :team_plannin
markdown_field_focused_selector = 'textarea:focus'
click_edit_issue_description
- issuable_form = find('[data-testid="issuable-form"]')
+ issuable_form = find_by_testid('issuable-form')
expect(issuable_form).to have_selector(markdown_field_focused_selector)
@@ -220,8 +220,8 @@ RSpec.describe "Issues > User edits issue", :js, feature_category: :team_plannin
click_button('Edit')
wait_for_requests
- find('[data-testid="unassign"]').click
- find('[data-testid="title"]').click
+ find_by_testid('unassign').click
+ find_by_testid('title').click
wait_for_requests
expect(page).to have_content 'None - assign yourself'
@@ -243,7 +243,7 @@ RSpec.describe "Issues > User edits issue", :js, feature_category: :team_plannin
end
page.within('.assignee') do
- find('[data-testid="title"]').click
+ find_by_testid('title').click
wait_for_requests
expect(page).to have_content user.name
@@ -262,7 +262,7 @@ RSpec.describe "Issues > User edits issue", :js, feature_category: :team_plannin
wait_for_requests
click_button user.name
- find('[data-testid="title"]').click
+ find_by_testid('title').click
wait_for_requests
expect(page).to have_content "None"
@@ -314,7 +314,7 @@ RSpec.describe "Issues > User edits issue", :js, feature_category: :team_plannin
wait_for_requests
click_button milestone.title
- page.within '[data-testid="select-milestone"]' do
+ within_testid('select-milestone') do
expect(page).to have_content milestone.title
end
@@ -322,7 +322,7 @@ RSpec.describe "Issues > User edits issue", :js, feature_category: :team_plannin
wait_for_requests
click_button 'No milestone'
- page.within '[data-testid="select-milestone"]' do
+ within_testid('select-milestone') do
expect(page).to have_content 'None'
end
end
@@ -376,7 +376,7 @@ RSpec.describe "Issues > User edits issue", :js, feature_category: :team_plannin
it 'adds due date to issue' do
date = Date.today.at_beginning_of_month + 2.days
- page.within '[data-testid="sidebar-due-date"]' do
+ within_testid('sidebar-due-date') do
click_button 'Edit'
page.within '.pika-single' do
click_button date.day
@@ -384,14 +384,14 @@ RSpec.describe "Issues > User edits issue", :js, feature_category: :team_plannin
wait_for_requests
- expect(find('[data-testid="sidebar-date-value"]').text).to have_content date.strftime('%b %-d, %Y')
+ expect(find_by_testid('sidebar-date-value').text).to have_content date.strftime('%b %-d, %Y')
end
end
it 'removes due date from issue' do
date = Date.today.at_beginning_of_month + 2.days
- page.within '[data-testid="sidebar-due-date"]' do
+ within_testid('sidebar-due-date') do
click_button 'Edit'
page.within '.pika-single' do
diff --git a/spec/features/issues/user_resets_their_incoming_email_token_spec.rb b/spec/features/issues/user_resets_their_incoming_email_token_spec.rb
index 55c66eb8a39..df6443a32b4 100644
--- a/spec/features/issues/user_resets_their_incoming_email_token_spec.rb
+++ b/spec/features/issues/user_resets_their_incoming_email_token_spec.rb
@@ -20,7 +20,7 @@ RSpec.describe 'Issues > User resets their incoming email token', feature_catego
page.within '#issuable-email-modal' do
previous_token = page.find('input[type="text"]').value
- find('[data-testid="reset_email_token_link"]').click
+ find_by_testid('reset_email_token_link').click
wait_for_requests
diff --git a/spec/features/issues/user_sees_sidebar_updates_in_realtime_spec.rb b/spec/features/issues/user_sees_sidebar_updates_in_realtime_spec.rb
index 91b18454af5..1d66c543b77 100644
--- a/spec/features/issues/user_sees_sidebar_updates_in_realtime_spec.rb
+++ b/spec/features/issues/user_sees_sidebar_updates_in_realtime_spec.rb
@@ -8,8 +8,8 @@ RSpec.describe 'Issues > Real-time sidebar', :js, :with_license, feature_categor
let_it_be(:user) { create(:user) }
let_it_be(:label) { create(:label, project: project, name: 'Development') }
- let(:labels_widget) { find('[data-testid="sidebar-labels"]') }
- let(:labels_value) { find('[data-testid="value-wrapper"]') }
+ let(:labels_widget) { find_by_testid('sidebar-labels') }
+ let(:labels_value) { find_by_testid('value-wrapper') }
before_all do
project.add_developer(user)
diff --git a/spec/features/issues/user_toggles_subscription_spec.rb b/spec/features/issues/user_toggles_subscription_spec.rb
index a1ea40c511f..6c611608510 100644
--- a/spec/features/issues/user_toggles_subscription_spec.rb
+++ b/spec/features/issues/user_toggles_subscription_spec.rb
@@ -32,17 +32,19 @@ RSpec.describe "User toggles subscription", :js, feature_category: :team_plannin
it 'unsubscribes from issue' do
find('.detail-page-header-actions .gl-new-dropdown-toggle').click
- subscription_button = find('[data-testid="notification-toggle"] [data-testid="toggle-wrapper"]')
+ within_testid('notification-toggle') do
+ subscription_button = find_by_testid('toggle-wrapper')
- # Check we're subscribed.
- expect(subscription_button).to have_css("button.is-checked")
+ # Check we're subscribed.
+ expect(subscription_button).to have_css("button.is-checked")
- # Toggle subscription.
- subscription_button.find('button').click
- wait_for_requests
+ # Toggle subscription.
+ subscription_button.find('button').click
+ wait_for_requests
- # Check we're unsubscribed.
- expect(subscription_button).to have_css("button:not(.is-checked)")
+ # Check we're unsubscribed.
+ expect(subscription_button).to have_css("button:not(.is-checked)")
+ end
end
end
@@ -57,17 +59,19 @@ RSpec.describe "User toggles subscription", :js, feature_category: :team_plannin
it 'subscribes to issue' do
find('.detail-page-header-actions .gl-new-dropdown-toggle').click
- subscription_button = find('[data-testid="notification-toggle"] [data-testid="toggle-wrapper"]')
+ within_testid('notification-toggle') do
+ subscription_button = find_by_testid('toggle-wrapper')
- # Check we're not subscribed.
- expect(subscription_button).to have_css("button:not(.is-checked)")
+ # Check we're not subscribed.
+ expect(subscription_button).to have_css("button:not(.is-checked)")
- # Toggle subscription.
- subscription_button.find('button').click
- wait_for_requests
+ # Toggle subscription.
+ subscription_button.find('button').click
+ wait_for_requests
- # Check we're subscribed.
- expect(subscription_button).to have_css("button.is-checked")
+ # Check we're subscribed.
+ expect(subscription_button).to have_css("button.is-checked")
+ end
end
end
@@ -80,7 +84,7 @@ RSpec.describe "User toggles subscription", :js, feature_category: :team_plannin
end
it 'toggles subscription' do
- subscription_button = find('[data-testid="subscribe-button"]')
+ subscription_button = find_by_testid('subscribe-button')
expect(page).to have_selector("button[title='Notifications off']")
subscription_button.click
diff --git a/spec/features/labels_hierarchy_spec.rb b/spec/features/labels_hierarchy_spec.rb
index c6c7342325b..c5bf230e988 100644
--- a/spec/features/labels_hierarchy_spec.rb
+++ b/spec/features/labels_hierarchy_spec.rb
@@ -58,7 +58,7 @@ RSpec.describe 'Labels Hierarchy', :js, feature_category: :team_planning do
expect(card).to have_selector('a', text: labeled_issue.title)
end
else
- within '[data-testid="filtered-search-input"]' do
+ within_testid('filtered-search-input') do
click_filtered_search_bar
click_on 'Label'
click_on '= is'
@@ -109,7 +109,7 @@ RSpec.describe 'Labels Hierarchy', :js, feature_category: :team_planning do
expect(card).to have_selector('a', text: labeled_issue_2.title)
end
else
- within '[data-testid="filtered-search-input"]' do
+ within_testid('filtered-search-input') do
click_filtered_search_bar
click_on 'Label'
click_on '= is'
@@ -170,7 +170,7 @@ RSpec.describe 'Labels Hierarchy', :js, feature_category: :team_planning do
wait_for_all_requests
- page.within '[data-testid="sidebar-labels"]' do
+ within_testid('sidebar-labels') do
click_button grandparent_group_label.title
click_button parent_group_label.title
click_button project_label_1.title
diff --git a/spec/features/merge_request/user_accepts_merge_request_spec.rb b/spec/features/merge_request/user_accepts_merge_request_spec.rb
index e3989a8a192..6e0ad749dbb 100644
--- a/spec/features/merge_request/user_accepts_merge_request_spec.rb
+++ b/spec/features/merge_request/user_accepts_merge_request_spec.rb
@@ -109,7 +109,7 @@ RSpec.describe 'User accepts a merge request', :js, :sidekiq_might_not_need_inli
end
it 'accepts a merge request' do
- find('[data-testid="widget_edit_commit_message"]').click
+ find_by_testid('widget_edit_commit_message').click
fill_in('merge-message-edit', with: 'wow such merge')
click_merge_button
diff --git a/spec/features/merge_request/user_assigns_themselves_spec.rb b/spec/features/merge_request/user_assigns_themselves_spec.rb
index ed4ea91f704..b1d87ee4904 100644
--- a/spec/features/merge_request/user_assigns_themselves_spec.rb
+++ b/spec/features/merge_request/user_assigns_themselves_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe 'Merge request > User assigns themselves', feature_category: :cod
wait_for_requests
expect do
- page.within('[data-testid="assignee-block-container"]') do
+ within_testid('assignee-block-container') do
click_button 'assign yourself'
end
@@ -40,7 +40,7 @@ RSpec.describe 'Merge request > User assigns themselves', feature_category: :cod
end
it 'does not display if related issues are already assigned' do
- page.within('[data-testid="assignee-block-container"]') do
+ within_testid('assignee-block-container') do
expect(page).not_to have_content 'Assign yourself'
end
end
@@ -54,7 +54,7 @@ RSpec.describe 'Merge request > User assigns themselves', feature_category: :cod
end
it 'does not show assignment link' do
- page.within('[data-testid="assignee-block-container"]') do
+ within_testid('assignee-block-container') do
expect(page).not_to have_content 'Assign yourself'
end
end
diff --git a/spec/features/merge_request/user_comments_on_diff_spec.rb b/spec/features/merge_request/user_comments_on_diff_spec.rb
index 9135f5c7b98..eb14bd39253 100644
--- a/spec/features/merge_request/user_comments_on_diff_spec.rb
+++ b/spec/features/merge_request/user_comments_on_diff_spec.rb
@@ -146,7 +146,7 @@ RSpec.describe 'User comments on a diff', :js, feature_category: :code_review_wo
click_button "Insert suggestion"
end
- within '[data-testid="content-editor"]' do
+ within_testid('content-editor') do
expect(page).to have_content('Suggested change From line')
end
end
diff --git a/spec/features/merge_request/user_comments_on_whitespace_hidden_diff_spec.rb b/spec/features/merge_request/user_comments_on_whitespace_hidden_diff_spec.rb
index c13fe8d1e45..233e6dd0f3e 100644
--- a/spec/features/merge_request/user_comments_on_whitespace_hidden_diff_spec.rb
+++ b/spec/features/merge_request/user_comments_on_whitespace_hidden_diff_spec.rb
@@ -23,7 +23,7 @@ RSpec.describe 'User comments on a diff with whitespace changes', :js, feature_c
context 'when hiding whitespace changes' do
before do
find('.js-show-diff-settings').click
- find('[data-testid="show-whitespace"]').click
+ find_by_testid('show-whitespace').click
wait_for_requests
end
diff --git a/spec/features/merge_request/user_creates_mr_spec.rb b/spec/features/merge_request/user_creates_mr_spec.rb
index 5f6e465d011..8c90a94b228 100644
--- a/spec/features/merge_request/user_creates_mr_spec.rb
+++ b/spec/features/merge_request/user_creates_mr_spec.rb
@@ -14,20 +14,20 @@ RSpec.describe 'Merge request > User creates MR', feature_category: :code_review
include ListboxHelpers
it 'creates new merge request', :js do
- find('[data-testid="assignee-ids-dropdown-toggle"]').click
+ find_by_testid('assignee-ids-dropdown-toggle').click
page.within '.dropdown-menu-user' do
click_link user2.name
end
expect(find('input[name="merge_request[assignee_ids][]"]', visible: false).value).to match(user2.id.to_s)
- page.within '[data-testid="assignee-ids-dropdown-toggle"]' do
+ within_testid('assignee-ids-dropdown-toggle') do
expect(page).to have_content user2.name
end
click_link 'Assign to me'
expect(find('input[name="merge_request[assignee_ids][]"]', visible: false).value).to match(user.id.to_s)
- page.within '[data-testid="assignee-ids-dropdown-toggle"]' do
+ within_testid('assignee-ids-dropdown-toggle') do
expect(page).to have_content user.name
end
@@ -38,12 +38,12 @@ RSpec.describe 'Merge request > User creates MR', feature_category: :code_review
click_button _('Select label')
wait_for_all_requests
- page.within '[data-testid="sidebar-labels"]' do
+ within_testid('sidebar-labels') do
click_button label.title
click_button label2.title
click_button _('Close')
wait_for_requests
- page.within('[data-testid="embedded-labels-list"]') do
+ within_testid('embedded-labels-list') do
expect(page).to have_content(label.title)
expect(page).to have_content(label2.title)
end
diff --git a/spec/features/projects/user_creates_project_spec.rb b/spec/features/projects/user_creates_project_spec.rb
index 96156f14cfc..b715733ca20 100644
--- a/spec/features/projects/user_creates_project_spec.rb
+++ b/spec/features/projects/user_creates_project_spec.rb
@@ -58,12 +58,13 @@ RSpec.describe 'User creates a project', :js, feature_category: :groups_and_proj
end
context 'when creating a project with SHA256 repository' do
- let(:sha256_field) { 'Use SHA-256 as the repository hashing algorithm' }
+ let(:sha256_field) { 'Use SHA-256 for repository hashing algorithm' }
it 'creates a new project' do
visit(new_project_path)
click_link 'Create blank project'
+ click_button 'Experimental settings'
fill_in(:project_name, with: 'With initial commits')
expect(page).to have_checked_field 'Initialize repository with a README'
diff --git a/spec/finders/crm/contacts_finder_spec.rb b/spec/finders/crm/contacts_finder_spec.rb
index d0339ce2b18..c54cd39534f 100644
--- a/spec/finders/crm/contacts_finder_spec.rb
+++ b/spec/finders/crm/contacts_finder_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe Crm::ContactsFinder do
subject { described_class.new(user, group: group).execute }
context 'when customer relations feature is enabled for the group' do
- let_it_be(:root_group) { create(:group, :crm_enabled) }
+ let_it_be(:root_group) { create(:group) }
let_it_be(:group) { create(:group, parent: root_group) }
let_it_be(:contact_1) { create(:contact, group: root_group) }
@@ -44,8 +44,8 @@ RSpec.describe Crm::ContactsFinder do
end
end
- context 'when customer relations feature is disabled for the group' do
- let_it_be(:group) { create(:group) }
+ context 'when crm feature is disabled for the group' do
+ let_it_be(:group) { create(:group, :crm_disabled) }
let_it_be(:contact) { create(:contact, group: group) }
before do
@@ -58,7 +58,7 @@ RSpec.describe Crm::ContactsFinder do
end
context 'with search informations' do
- let_it_be(:search_test_group) { create(:group, :crm_enabled) }
+ let_it_be(:search_test_group) { create(:group) }
let_it_be(:search_test_a) do
create(
@@ -189,7 +189,7 @@ RSpec.describe Crm::ContactsFinder do
end
describe '.counts_by_state' do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:active_contacts) { create_list(:contact, 3, group: group, state: :active) }
let_it_be(:inactive_contacts) { create_list(:contact, 2, group: group, state: :inactive) }
diff --git a/spec/finders/crm/organizations_finder_spec.rb b/spec/finders/crm/organizations_finder_spec.rb
index bc174f927a7..fd65cd22cb5 100644
--- a/spec/finders/crm/organizations_finder_spec.rb
+++ b/spec/finders/crm/organizations_finder_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe Crm::OrganizationsFinder do
subject { described_class.new(user, group: group).execute }
context 'when customer relations feature is enabled for the group' do
- let_it_be(:root_group) { create(:group, :crm_enabled) }
+ let_it_be(:root_group) { create(:group) }
let_it_be(:group) { create(:group, parent: root_group) }
let_it_be(:crm_organization_1) { create(:crm_organization, group: root_group) }
@@ -45,7 +45,7 @@ RSpec.describe Crm::OrganizationsFinder do
end
context 'when customer relations feature is disabled for the group' do
- let_it_be(:group) { create(:group) }
+ let_it_be(:group) { create(:group, :crm_disabled) }
let_it_be(:crm_organization) { create(:crm_organization, group: group) }
before do
@@ -58,7 +58,7 @@ RSpec.describe Crm::OrganizationsFinder do
end
context 'with search informations' do
- let_it_be(:search_test_group) { create(:group, :crm_enabled) }
+ let_it_be(:search_test_group) { create(:group) }
let_it_be(:search_test_a) do
create(
@@ -130,7 +130,7 @@ RSpec.describe Crm::OrganizationsFinder do
end
context 'when sorting' do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:sort_test_a) do
create(
@@ -185,7 +185,7 @@ RSpec.describe Crm::OrganizationsFinder do
end
describe '.counts_by_state' do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:active_crm_organizations) { create_list(:crm_organization, 3, group: group, state: :active) }
let_it_be(:inactive_crm_organizations) { create_list(:crm_organization, 2, group: group, state: :inactive) }
diff --git a/spec/frontend/accordion/index_spec.js b/spec/frontend/accordion/index_spec.js
new file mode 100644
index 00000000000..10ce1cdd00e
--- /dev/null
+++ b/spec/frontend/accordion/index_spec.js
@@ -0,0 +1,52 @@
+import initAccordion from '~/accordion';
+import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
+
+describe('Init Accordion component', () => {
+ beforeEach(() => {
+ setHTMLFixture(
+ '
',
+ );
+ initAccordion(document.querySelector('.js-accordion'));
+ });
+
+ afterEach(() => resetHTMLFixture());
+
+ const findAccordionTrigger = () => document.querySelector('button');
+ const findAccordionItem = () => document.querySelector('.accordion-item');
+ const findSvgIconLink = () => document.querySelector('use').getAttribute('xlink:href');
+
+ describe('expanded', () => {
+ beforeEach(() => findAccordionTrigger().click());
+
+ it('adds a `show` class to the accordion item', () => {
+ expect(findAccordionItem().classList.contains('show')).toBe(true);
+ });
+
+ it('renders a chevron-down icon', () => {
+ expect(findSvgIconLink()).toContain('#chevron-down');
+ });
+
+ it('renders a button with the correct aria-expanded value', () => {
+ expect(findAccordionTrigger().getAttribute('aria-expanded')).toBe('true');
+ });
+ });
+
+ describe('collapsed', () => {
+ beforeEach(() => {
+ findAccordionTrigger().click(); // expands the accordion
+ findAccordionTrigger().click(); // collapses the accordion
+ });
+
+ it('removes `show` class from the accordion item', () => {
+ expect(findAccordionItem().classList.contains('show')).toBe(false);
+ });
+
+ it('renders a chevron-right icon', () => {
+ expect(findSvgIconLink()).toContain('#chevron-right');
+ });
+
+ it('renders a button with the correct aria-expanded value', () => {
+ expect(findAccordionTrigger().getAttribute('aria-expanded')).toBe('false');
+ });
+ });
+});
diff --git a/spec/frontend/achievements/achievements_app_spec.js b/spec/frontend/achievements/achievements_app_spec.js
new file mode 100644
index 00000000000..46fc085af45
--- /dev/null
+++ b/spec/frontend/achievements/achievements_app_spec.js
@@ -0,0 +1,94 @@
+import { GlEmptyState, GlKeysetPagination, GlLoadingIcon, GlTableLite } from '@gitlab/ui';
+import Vue from 'vue';
+import VueApollo from 'vue-apollo';
+import getGroupAchievementsResponse from 'test_fixtures/graphql/get_group_achievements_response.json';
+import getGroupAchievementsEmptyResponse from 'test_fixtures/graphql/get_group_achievements_empty_response.json';
+import getGroupAchievementsPaginatedResponse from 'test_fixtures/graphql/get_group_achievements_paginated_response.json';
+import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
+import createMockApollo from 'helpers/mock_apollo_helper';
+import waitForPromises from 'helpers/wait_for_promises';
+import AchievementsApp from '~/achievements/components/achievements_app.vue';
+import getGroupAchievementsQuery from '~/achievements/components/graphql/get_group_achievements.query.graphql';
+
+Vue.use(VueApollo);
+
+describe('Achievements app', () => {
+ let wrapper;
+ let fakeApollo;
+ let queryHandler;
+
+ const findEmptyState = () => wrapper.findComponent(GlEmptyState);
+ const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
+ const findPagingControls = () => wrapper.findComponent(GlKeysetPagination);
+ const findTable = () => wrapper.findComponent(GlTableLite);
+
+ const mountComponent = ({ queryResponse = getGroupAchievementsResponse } = {}) => {
+ queryHandler = jest.fn().mockResolvedValue(queryResponse);
+ fakeApollo = createMockApollo([[getGroupAchievementsQuery, queryHandler]]);
+ wrapper = shallowMountExtended(AchievementsApp, {
+ provide: {
+ groupFullPath: 'flightjs',
+ },
+ apolloProvider: fakeApollo,
+ });
+ return waitForPromises();
+ };
+
+ it('should render loading state', () => {
+ mountComponent();
+
+ expect(findLoadingIcon().exists()).toBe(true);
+ });
+
+ describe('on successful load', () => {
+ it('should render table with expected props', async () => {
+ await mountComponent();
+
+ const { items } = findTable().vm.$attrs;
+
+ expect(findTable().exists()).toBe(true);
+ expect(items).toContainEqual(expect.objectContaining({ name: 'Hero' }));
+ expect(items).toContainEqual(expect.objectContaining({ name: 'Star' }));
+ expect(items).toContainEqual(expect.objectContaining({ name: 'Legend' }));
+ });
+
+ describe('with no achievements', () => {
+ it('should render the empty state', async () => {
+ await mountComponent({ queryResponse: getGroupAchievementsEmptyResponse });
+
+ expect(findEmptyState().exists()).toBe(true);
+ });
+ });
+
+ describe('with multiple pages', () => {
+ it('should render paging controls', async () => {
+ await mountComponent({ queryResponse: getGroupAchievementsPaginatedResponse });
+
+ expect(findPagingControls().exists()).toBe(true);
+ });
+
+ describe('when the next page is selected', () => {
+ it('should pass the end cursor', async () => {
+ await mountComponent({ queryResponse: getGroupAchievementsPaginatedResponse });
+ findPagingControls().vm.$emit('next', 'foo');
+ await waitForPromises();
+
+ expect(queryHandler).toHaveBeenCalledWith({
+ after: null,
+ before: null,
+ first: 20,
+ groupFullPath: 'flightjs',
+ last: null,
+ });
+ expect(queryHandler).toHaveBeenCalledWith({
+ after: 'foo',
+ before: null,
+ first: 20,
+ groupFullPath: 'flightjs',
+ last: null,
+ });
+ });
+ });
+ });
+ });
+});
diff --git a/spec/frontend/fixtures/achievements.rb b/spec/frontend/fixtures/achievements.rb
new file mode 100644
index 00000000000..7fcdd8fa843
--- /dev/null
+++ b/spec/frontend/fixtures/achievements.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Achievements (JavaScript fixtures)', feature_category: :user_profile do
+ include JavaScriptFixturesHelpers
+ include ApiHelpers
+
+ describe GraphQL::Query, type: :request do
+ include GraphqlHelpers
+
+ let_it_be(:group) { create(:group, :public) }
+
+ let(:query_path) { 'achievements/components/graphql/get_group_achievements.query.graphql' }
+ let(:query) { get_graphql_query_as_string(query_path) }
+
+ it "graphql/get_group_achievements_empty_response.json" do
+ post_graphql(query, current_user: nil, variables: { group_full_path: group.full_path })
+
+ expect_graphql_errors_to_be_empty
+ end
+
+ context 'with achievements' do
+ before_all do
+ create(:achievement, namespace: group, name: "Hero")
+ create(:achievement, namespace: group, name: "Star")
+ create(:achievement, namespace: group, name: "Legend")
+ end
+
+ it "graphql/get_group_achievements_response.json" do
+ post_graphql(query, current_user: nil, variables: { group_full_path: group.full_path })
+
+ expect_graphql_errors_to_be_empty
+ end
+
+ it "graphql/get_group_achievements_paginated_response.json" do
+ post_graphql(query, current_user: nil, variables: { group_full_path: group.full_path, first: 2 })
+
+ expect_graphql_errors_to_be_empty
+ end
+ end
+ end
+end
diff --git a/spec/frontend/releases/__snapshots__/util_spec.js.snap b/spec/frontend/releases/__snapshots__/util_spec.js.snap
index 983db8846c6..e517f9569ef 100644
--- a/spec/frontend/releases/__snapshots__/util_spec.js.snap
+++ b/spec/frontend/releases/__snapshots__/util_spec.js.snap
@@ -43,7 +43,7 @@ Object {
},
"author": Object {
"__typename": "UserCore",
- "avatarUrl": "https://www.gravatar.com/avatar/eb329fbfeccd9e6d45ff159da8736876?s=80&d=identicon",
+ "avatarUrl": "https://www.gravatar.com/avatar/47420c558894b028457615db5156a52e6b791b829a6ca611656bb2560f9dbfc3?s=80&d=identicon",
"id": Any
,
"username": "user1",
"webUrl": "http://localhost/user1",
@@ -149,7 +149,7 @@ Object {
},
"author": Object {
"__typename": "UserCore",
- "avatarUrl": "https://www.gravatar.com/avatar/eb329fbfeccd9e6d45ff159da8736876?s=80&d=identicon",
+ "avatarUrl": "https://www.gravatar.com/avatar/47420c558894b028457615db5156a52e6b791b829a6ca611656bb2560f9dbfc3?s=80&d=identicon",
"id": Any,
"username": "user1",
"webUrl": "http://localhost/user1",
@@ -386,7 +386,7 @@ Object {
},
"author": Object {
"__typename": "UserCore",
- "avatarUrl": "https://www.gravatar.com/avatar/eb329fbfeccd9e6d45ff159da8736876?s=80&d=identicon",
+ "avatarUrl": "https://www.gravatar.com/avatar/47420c558894b028457615db5156a52e6b791b829a6ca611656bb2560f9dbfc3?s=80&d=identicon",
"id": Any,
"username": "user1",
"webUrl": "http://localhost/user1",
diff --git a/spec/graphql/mutations/customer_relations/contacts/create_spec.rb b/spec/graphql/mutations/customer_relations/contacts/create_spec.rb
index 3ee898c2079..2cca77b8983 100644
--- a/spec/graphql/mutations/customer_relations/contacts/create_spec.rb
+++ b/spec/graphql/mutations/customer_relations/contacts/create_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe Mutations::CustomerRelations::Contacts::Create do
let_it_be(:user) { create(:user) }
- let(:group) { create(:group, :crm_enabled) }
+ let(:group) { create(:group) }
let(:not_found_or_does_not_belong) { 'The specified organization was not found or does not belong to this group' }
let(:valid_params) do
attributes_for(:contact,
@@ -41,7 +41,7 @@ RSpec.describe Mutations::CustomerRelations::Contacts::Create do
end
context 'when crm_enabled is false' do
- let(:group) { create(:group) }
+ let(:group) { create(:group, :crm_disabled) }
it 'raises an error' do
expect { resolve_mutation }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable)
diff --git a/spec/graphql/mutations/customer_relations/contacts/update_spec.rb b/spec/graphql/mutations/customer_relations/contacts/update_spec.rb
index 421bb4f1b06..2ea13dbeb3d 100644
--- a/spec/graphql/mutations/customer_relations/contacts/update_spec.rb
+++ b/spec/graphql/mutations/customer_relations/contacts/update_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Mutations::CustomerRelations::Contacts::Update do
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let(:first_name) { 'Lionel' }
let(:last_name) { 'Smith' }
diff --git a/spec/graphql/mutations/customer_relations/organizations/create_spec.rb b/spec/graphql/mutations/customer_relations/organizations/create_spec.rb
index cf1ff2d5653..f9aef726499 100644
--- a/spec/graphql/mutations/customer_relations/organizations/create_spec.rb
+++ b/spec/graphql/mutations/customer_relations/organizations/create_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Mutations::CustomerRelations::Organizations::Create do
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let(:valid_params) do
attributes_for(:crm_organization,
diff --git a/spec/graphql/mutations/customer_relations/organizations/update_spec.rb b/spec/graphql/mutations/customer_relations/organizations/update_spec.rb
index 2fad320b497..c62d6859241 100644
--- a/spec/graphql/mutations/customer_relations/organizations/update_spec.rb
+++ b/spec/graphql/mutations/customer_relations/organizations/update_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Mutations::CustomerRelations::Organizations::Update do
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let(:name) { 'GitLab' }
let(:default_rate) { 1000.to_f }
diff --git a/spec/graphql/resolvers/crm/contact_state_counts_resolver_spec.rb b/spec/graphql/resolvers/crm/contact_state_counts_resolver_spec.rb
index 0128ec792b3..607855ef41c 100644
--- a/spec/graphql/resolvers/crm/contact_state_counts_resolver_spec.rb
+++ b/spec/graphql/resolvers/crm/contact_state_counts_resolver_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe Resolvers::Crm::ContactStateCountsResolver do
include GraphqlHelpers
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
before_all do
create(:contact, group: group, email: "x@test.com")
diff --git a/spec/graphql/resolvers/crm/contacts_resolver_spec.rb b/spec/graphql/resolvers/crm/contacts_resolver_spec.rb
index 1a53f42633f..f7ca034842b 100644
--- a/spec/graphql/resolvers/crm/contacts_resolver_spec.rb
+++ b/spec/graphql/resolvers/crm/contacts_resolver_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe Resolvers::Crm::ContactsResolver do
include GraphqlHelpers
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:contact_a) do
create(
diff --git a/spec/graphql/resolvers/crm/organization_state_counts_resolver_spec.rb b/spec/graphql/resolvers/crm/organization_state_counts_resolver_spec.rb
index f6c2040b7d0..eb704a538d0 100644
--- a/spec/graphql/resolvers/crm/organization_state_counts_resolver_spec.rb
+++ b/spec/graphql/resolvers/crm/organization_state_counts_resolver_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe Resolvers::Crm::OrganizationStateCountsResolver do
include GraphqlHelpers
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
before_all do
create(:crm_organization, group: group, name: "ABC Corp")
diff --git a/spec/graphql/resolvers/crm/organizations_resolver_spec.rb b/spec/graphql/resolvers/crm/organizations_resolver_spec.rb
index edc1986799a..f3685014b61 100644
--- a/spec/graphql/resolvers/crm/organizations_resolver_spec.rb
+++ b/spec/graphql/resolvers/crm/organizations_resolver_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe Resolvers::Crm::OrganizationsResolver do
include GraphqlHelpers
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:crm_organization_a) do
create(
diff --git a/spec/helpers/avatars_helper_spec.rb b/spec/helpers/avatars_helper_spec.rb
index aab63ea0f70..88310086cc5 100644
--- a/spec/helpers/avatars_helper_spec.rb
+++ b/spec/helpers/avatars_helper_spec.rb
@@ -225,7 +225,7 @@ RSpec.describe AvatarsHelper, feature_category: :source_code_management do
stub_config_setting(https: false)
expect(helper.gravatar_icon(user_email))
- .to match('https://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118')
+ .to match('https://www.gravatar.com/avatar/0925f997eb0d742678f66d2da134d15d842d57722af5f7605c4785cb5358831b')
end
it 'uses HTTPs when configured' do
@@ -239,7 +239,7 @@ RSpec.describe AvatarsHelper, feature_category: :source_code_management do
stub_gravatar_setting(plain_url: 'http://example.local/?s=%{size}&hash=%{hash}')
expect(gravatar_icon(user_email, 20))
- .to eq('http://example.local/?s=40&hash=b58c6f14d292556214bd64909bcdb118')
+ .to eq('http://example.local/?s=40&hash=0925f997eb0d742678f66d2da134d15d842d57722af5f7605c4785cb5358831b')
end
it 'accepts a custom size argument' do
@@ -261,12 +261,6 @@ RSpec.describe AvatarsHelper, feature_category: :source_code_management do
expect(normal).to eq upcase
end
end
-
- context 'with FIPS enabled', :fips_mode do
- it 'returns a generic avatar' do
- expect(helper.gravatar_icon(user_email)).to match_asset_path(described_class::DEFAULT_AVATAR_PATH)
- end
- end
end
end
diff --git a/spec/lib/api/entities/bulk_imports/entity_failure_spec.rb b/spec/lib/api/entities/bulk_imports/entity_failure_spec.rb
index 20563bfb685..ee96bc1cae6 100644
--- a/spec/lib/api/entities/bulk_imports/entity_failure_spec.rb
+++ b/spec/lib/api/entities/bulk_imports/entity_failure_spec.rb
@@ -39,4 +39,18 @@ RSpec.describe API::Entities::BulkImports::EntityFailure, feature_category: :imp
expect(subject[:exception_message]).to eq(filtered_message.truncate(255))
end
end
+
+ describe 'relation' do
+ it 'returns relation' do
+ expect(subject[:relation]).to eq('test')
+ end
+
+ context 'when subrelation is present' do
+ it 'includes subrelation' do
+ failure.update!(subrelation: 'subrelation')
+
+ expect(subject[:relation]).to eq('test, subrelation')
+ end
+ end
+ end
end
diff --git a/spec/lib/bulk_imports/ndjson_pipeline_spec.rb b/spec/lib/bulk_imports/ndjson_pipeline_spec.rb
index 5611879868d..55a9292e48d 100644
--- a/spec/lib/bulk_imports/ndjson_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/ndjson_pipeline_spec.rb
@@ -203,6 +203,7 @@ RSpec.describe BulkImports::NdjsonPipeline, feature_category: :importers do
failure = entity.failures.first
expect(failure.pipeline_class).to eq(tracker.pipeline_name)
+ expect(failure.subrelation).to eq('LabelPriority')
expect(failure.exception_class).to eq('RecordInvalid')
expect(failure.exception_message).to eq("Project can't be blank, Priority can't be blank, and Priority is not a number")
end
diff --git a/spec/lib/gitlab/database/partitioning/list/convert_table_spec.rb b/spec/lib/gitlab/database/partitioning/list/convert_table_spec.rb
index 0b3528d5691..a0158b039e3 100644
--- a/spec/lib/gitlab/database/partitioning/list/convert_table_spec.rb
+++ b/spec/lib/gitlab/database/partitioning/list/convert_table_spec.rb
@@ -285,9 +285,11 @@ RSpec.describe Gitlab::Database::Partitioning::List::ConvertTable, feature_categ
where(:case_name, :fault) do
[
["creating parent table", lazy { fail_sql_matching(/CREATE/i) }],
- ["adding the first foreign key", lazy { fail_adding_fk(parent_table_name, referenced_table_name) }],
+ ["adding the first foreign key", lazy do
+ fail_adding_concurrent_fk(parent_table_name, referenced_table_name)
+ end],
["adding the second foreign key", lazy do
- fail_adding_fk(parent_table_name, other_referenced_table_name)
+ fail_adding_concurrent_fk(parent_table_name, other_referenced_table_name)
end],
["attaching table", lazy { fail_sql_matching(/ATTACH/i) }]
]
@@ -338,8 +340,7 @@ RSpec.describe Gitlab::Database::Partitioning::List::ConvertTable, feature_categ
it 'sets up partitioning analysis for parent table' do
expect(migration_context).to receive(:execute).with(/CREATE TABLE/).ordered.and_call_original
- expect(migration_context).to receive(:execute).with(/ALTER TABLE/).ordered.and_call_original
- expect(migration_context).to receive(:disable_statement_timeout).ordered.and_call_original
+ expect(migration_context).to receive(:execute).exactly(5).with(/ALTER TABLE/).ordered.and_call_original
expect(migration_context).to receive(:execute).with(/ANALYZE VERBOSE/).ordered.and_call_original
partition
diff --git a/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb b/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb
index 9d484198cc0..806c01a993e 100644
--- a/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb
+++ b/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler, feature_category: :se
let(:message_id) { 'CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com' }
let(:issue_email_participants_count) { 1 }
- let_it_be(:group) { create(:group, :private, :crm_enabled, name: "email") }
+ let_it_be(:group) { create(:group, :private, name: "email") }
let(:expected_subject) { "The message subject! @all" }
let(:expected_description) do
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index ca6d9bde835..0cd0cc77923 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -1031,6 +1031,7 @@ issuable_sla:
- issue
push_rule:
- group
+ - organization
bulk_import_export:
- group
service_desk_setting:
diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml
index 73b945d4274..5ceac6cad98 100644
--- a/spec/lib/gitlab/import_export/safe_model_attributes.yml
+++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml
@@ -1032,6 +1032,7 @@ PushRule:
- commit_committer_check
- regexp_uses_re2
- reject_non_dco_commits
+ - organization_id
MergeRequest::CleanupSchedule:
- id
- scheduled_at
diff --git a/spec/models/bulk_imports/failure_spec.rb b/spec/models/bulk_imports/failure_spec.rb
index bbb5ad52fe1..7f583296fda 100644
--- a/spec/models/bulk_imports/failure_spec.rb
+++ b/spec/models/bulk_imports/failure_spec.rb
@@ -43,6 +43,25 @@ RSpec.describe BulkImports::Failure, type: :model, feature_category: :importers
expect(failure.relation).to eq('test_relation')
end
end
+
+ context 'when subrelation is nil' do
+ it 'returns relation' do
+ failure = described_class.new(pipeline_class: 'BulkImports::Common::Pipelines::WikiPipeline')
+
+ expect(failure.relation).to eq('wiki')
+ end
+ end
+
+ context 'when subrelation is present' do
+ it 'returns relation and subrelation' do
+ failure = described_class.new(
+ subrelation: 'subrelation',
+ pipeline_class: 'BulkImports::Common::Pipelines::WikiPipeline'
+ )
+
+ expect(failure.relation).to eq('wiki, subrelation')
+ end
+ end
end
describe '#exception_message=' do
@@ -74,4 +93,12 @@ RSpec.describe BulkImports::Failure, type: :model, feature_category: :importers
expect(failure.source_url.size).to eq(255)
end
end
+
+ describe '#subrelation=' do
+ it 'truncates subrelation to 255 characters' do
+ failure = described_class.new
+ failure.subrelation = 'A' * 1000
+ expect(failure.subrelation.size).to eq(255)
+ end
+ end
end
diff --git a/spec/models/ci/build_runner_session_spec.rb b/spec/models/ci/build_runner_session_spec.rb
index dac7edbe6cc..198eb936497 100644
--- a/spec/models/ci/build_runner_session_spec.rb
+++ b/spec/models/ci/build_runner_session_spec.rb
@@ -183,11 +183,11 @@ RSpec.describe Ci::BuildRunnerSession, model: true, feature_category: :continuou
let(:build_runner_session) { create(:ci_build_runner_session, build: new_build) }
before do
- stub_current_partition_id
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
it 'assigns the same partition id as the one that build has' do
- expect(build_runner_session.partition_id).to eq(ci_testing_partition_id)
+ expect(build_runner_session.partition_id).to eq(ci_testing_partition_id_for_check_constraints)
end
end
end
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 8741d347c36..67d163a3404 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -5601,14 +5601,14 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def
let(:ci_build) { create(:ci_build, pipeline: new_pipeline) }
before do
- stub_current_partition_id
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
it 'includes partition_id in the token prefix' do
prefix = ci_build.token.match(/^glcbt-([\h]+)_/)
partition_prefix = prefix[1].to_i(16)
- expect(partition_prefix).to eq(ci_testing_partition_id)
+ expect(partition_prefix).to eq(ci_testing_partition_id_for_check_constraints)
end
end
diff --git a/spec/models/ci/build_trace_metadata_spec.rb b/spec/models/ci/build_trace_metadata_spec.rb
index 866d94b4cbe..667f519ecf5 100644
--- a/spec/models/ci/build_trace_metadata_spec.rb
+++ b/spec/models/ci/build_trace_metadata_spec.rb
@@ -169,11 +169,11 @@ RSpec.describe Ci::BuildTraceMetadata, feature_category: :continuous_integration
let(:metadata) { create(:ci_build_trace_metadata, build: new_build) }
before do
- stub_current_partition_id
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
it 'assigns the same partition id as the one that build has' do
- expect(metadata.partition_id).to eq(ci_testing_partition_id)
+ expect(metadata.partition_id).to eq(ci_testing_partition_id_for_check_constraints)
end
end
end
diff --git a/spec/models/ci/job_variable_spec.rb b/spec/models/ci/job_variable_spec.rb
index a56e6b6be43..8b1191a3930 100644
--- a/spec/models/ci/job_variable_spec.rb
+++ b/spec/models/ci/job_variable_spec.rb
@@ -49,15 +49,15 @@ RSpec.describe Ci::JobVariable, feature_category: :continuous_integration do
let(:job_variable_2) { build(:ci_job_variable, job: ci_build) }
before do
- stub_current_partition_id
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
it 'creates job variables successfully', :aggregate_failures do
described_class.bulk_insert!([job_variable, job_variable_2])
expect(described_class.count).to eq(2)
- expect(described_class.first.partition_id).to eq(ci_testing_partition_id)
- expect(described_class.last.partition_id).to eq(ci_testing_partition_id)
+ expect(described_class.first.partition_id).to eq(ci_testing_partition_id_for_check_constraints)
+ expect(described_class.last.partition_id).to eq(ci_testing_partition_id_for_check_constraints)
end
end
end
diff --git a/spec/models/ci/pending_build_spec.rb b/spec/models/ci/pending_build_spec.rb
index 331522070df..076aad34a94 100644
--- a/spec/models/ci/pending_build_spec.rb
+++ b/spec/models/ci/pending_build_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Ci::PendingBuild do
+RSpec.describe Ci::PendingBuild, feature_category: :continuous_integration do
let_it_be(:project) { create(:project) }
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
@@ -200,21 +200,20 @@ RSpec.describe Ci::PendingBuild do
include Ci::PartitioningHelpers
before do
- stub_current_partition_id
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
let(:new_pipeline ) { create(:ci_pipeline, project: pipeline.project) }
let(:new_build) { create(:ci_build, pipeline: new_pipeline) }
it 'assigns the same partition id as the one that build has', :aggregate_failures do
- expect(new_build.partition_id).to eq ci_testing_partition_id
- expect(new_build.partition_id).not_to eq pipeline.partition_id
+ expect(new_build.partition_id).to eq ci_testing_partition_id_for_check_constraints
described_class.upsert_from_build!(build)
described_class.upsert_from_build!(new_build)
expect(build.reload.queuing_entry.partition_id).to eq pipeline.partition_id
- expect(new_build.reload.queuing_entry.partition_id).to eq ci_testing_partition_id
+ expect(new_build.reload.queuing_entry.partition_id).to eq ci_testing_partition_id_for_check_constraints
end
end
diff --git a/spec/models/ci/resource_group_spec.rb b/spec/models/ci/resource_group_spec.rb
index 9e98cc884de..e2aaeb2a18e 100644
--- a/spec/models/ci/resource_group_spec.rb
+++ b/spec/models/ci/resource_group_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Ci::ResourceGroup do
+RSpec.describe Ci::ResourceGroup, feature_category: :continuous_delivery do
let_it_be(:group) { create(:group) }
it_behaves_like 'cleanup by a loose foreign key' do
@@ -37,7 +37,7 @@ RSpec.describe Ci::ResourceGroup do
include Ci::PartitioningHelpers
before do
- stub_current_partition_id
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
subject { resource_group.assign_resource_to(build) }
@@ -78,7 +78,7 @@ RSpec.describe Ci::ResourceGroup do
include Ci::PartitioningHelpers
before do
- stub_current_partition_id
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
subject { resource_group.release_resource_from(build) }
diff --git a/spec/models/ci/running_build_spec.rb b/spec/models/ci/running_build_spec.rb
index 7f254bd235c..0a81eaf9ac0 100644
--- a/spec/models/ci/running_build_spec.rb
+++ b/spec/models/ci/running_build_spec.rb
@@ -54,21 +54,20 @@ RSpec.describe Ci::RunningBuild, feature_category: :continuous_integration do
include Ci::PartitioningHelpers
before do
- stub_current_partition_id
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
let(:new_pipeline ) { create(:ci_pipeline, project: pipeline.project) }
let(:new_build) { create(:ci_build, :running, pipeline: new_pipeline, runner: runner) }
it 'assigns the same partition id as the one that build has', :aggregate_failures do
- expect(new_build.partition_id).to eq ci_testing_partition_id
- expect(new_build.partition_id).not_to eq pipeline.partition_id
+ expect(new_build.partition_id).to eq ci_testing_partition_id_for_check_constraints
described_class.upsert_shared_runner_build!(build)
described_class.upsert_shared_runner_build!(new_build)
expect(build.reload.runtime_metadata.partition_id).to eq pipeline.partition_id
- expect(new_build.reload.runtime_metadata.partition_id).to eq ci_testing_partition_id
+ expect(new_build.reload.runtime_metadata.partition_id).to eq ci_testing_partition_id_for_check_constraints
end
end
diff --git a/spec/models/ci/sources/pipeline_spec.rb b/spec/models/ci/sources/pipeline_spec.rb
index 036708ed61e..6bc848fadb8 100644
--- a/spec/models/ci/sources/pipeline_spec.rb
+++ b/spec/models/ci/sources/pipeline_spec.rb
@@ -44,12 +44,12 @@ RSpec.describe Ci::Sources::Pipeline, feature_category: :continuous_integration
let(:source_pipeline) { create(:ci_sources_pipeline, pipeline: new_pipeline) }
before do
- stub_current_partition_id
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
it 'assigns partition_id and source_partition_id from pipeline and source_job', :aggregate_failures do
- expect(source_pipeline.partition_id).to eq(ci_testing_partition_id)
- expect(source_pipeline.source_partition_id).to eq(ci_testing_partition_id)
+ expect(source_pipeline.partition_id).to eq(ci_testing_partition_id_for_check_constraints)
+ expect(source_pipeline.source_partition_id).to eq(ci_testing_partition_id_for_check_constraints)
end
end
end
diff --git a/spec/models/concerns/semantic_versionable_spec.rb b/spec/models/concerns/semantic_versionable_spec.rb
index 500b4564fbe..dc476d603ac 100644
--- a/spec/models/concerns/semantic_versionable_spec.rb
+++ b/spec/models/concerns/semantic_versionable_spec.rb
@@ -5,19 +5,23 @@ require 'spec_helper'
RSpec.describe SemanticVersionable, feature_category: :mlops do
using RSpec::Parameterized::TableSyntax
+ before_all do
+ ActiveRecord::Schema.define do |_t|
+ create_table :_test_semantic_versions, force: true do |t|
+ t.integer :semver_major
+ t.integer :semver_minor
+ t.integer :semver_patch
+ t.string :semver_prerelease
+ end
+ end
+ end
+
let(:model_class) do
Class.new(ActiveRecord::Base) do
include SemanticVersionable
semver_method :semver
- # we need a table for the dummy class to operate
- self.table_name = 'ml_model_versions'
-
- def self.name
- 'Ml::ModelVersion'
- end
-
- attr_accessor :major, :minor, :patch, :prerelease
+ self.table_name = '_test_semantic_versions'
end
end
@@ -94,4 +98,22 @@ RSpec.describe SemanticVersionable, feature_category: :mlops do
expect(model_instance.valid?).to be true
end
end
+
+ describe 'scopes' do
+ let(:first_release) { model_class.create!(semver: '1.0.1') }
+ let(:second_release) { model_class.create!(semver: '3.0.1') }
+ let(:patch) { model_class.create!(semver: '2.0.1') }
+
+ describe '.order_by_semantic_version_asc' do
+ it 'orders the versions by semantic order ascending' do
+ expect(model_class.order_by_semantic_version_asc).to eq([first_release, patch, second_release])
+ end
+ end
+
+ describe '.order_by_semantic_version_desc' do
+ it 'orders the versions by semantic order descending' do
+ expect(model_class.order_by_semantic_version_desc).to eq([second_release, patch, first_release])
+ end
+ end
+ end
end
diff --git a/spec/models/customer_relations/contact_state_counts_spec.rb b/spec/models/customer_relations/contact_state_counts_spec.rb
index a19f6f08489..de9da7cf88d 100644
--- a/spec/models/customer_relations/contact_state_counts_spec.rb
+++ b/spec/models/customer_relations/contact_state_counts_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe CustomerRelations::ContactStateCounts do
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let(:counter) { described_class.new(user, group, params) }
let(:params) { {} }
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index ce2c9ced47f..69723533943 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -3260,8 +3260,8 @@ RSpec.describe Group, feature_category: :groups_and_projects do
end
describe '#crm_enabled?' do
- it 'returns false where no crm_settings exist' do
- expect(group.crm_enabled?).to be_falsey
+ it 'returns true where no crm_settings exist' do
+ expect(group.crm_enabled?).to be_truthy
end
it 'returns false where crm_settings.state is disabled' do
@@ -3277,7 +3277,7 @@ RSpec.describe Group, feature_category: :groups_and_projects do
end
it 'returns true where crm_settings.state is enabled for subgroup' do
- subgroup = create(:group, :crm_enabled, parent: group)
+ subgroup = create(:group, parent: group)
expect(subgroup.crm_enabled?).to be_truthy
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index cae5291fb56..1a7f2e6614b 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -5402,57 +5402,32 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr
describe '#has_ci_config_file?' do
subject(:has_ci_config_file) { project.has_ci_config_file? }
- # Extract these from `shared_examples` when the FF ci_refactor_has_ci_config_file is removed.
- shared_examples '#has_ci_config_file?' do
- context 'when the repository does not exist' do
- let_it_be(:project) { create(:project) }
+ context 'when the repository does not exist' do
+ let_it_be(:project) { create(:project) }
- it { is_expected.to be_falsey }
- end
-
- context 'when the repository has a .gitlab-ci.yml file' do
- let_it_be(:project) { create(:project, :small_repo, files: { '.gitlab-ci.yml' => 'test' }) }
-
- it { is_expected.to be_truthy }
- end
-
- context 'when the repository does not have a .gitlab-ci.yml file' do
- let_it_be(:project) { create(:project, :small_repo, files: { 'README.md' => 'hello' }) }
-
- it { is_expected.to be_falsey }
- end
+ it { is_expected.to be_falsey }
end
- context 'when the FF ci_refactor_has_ci_config_file is enabled' do
- it_behaves_like '#has_ci_config_file?'
+ context 'when the repository has a .gitlab-ci.yml file' do
+ let_it_be(:project) { create(:project, :small_repo, files: { '.gitlab-ci.yml' => 'test' }) }
- context 'when the repository has a custom CI config file' do
- let_it_be(:project) { create(:project, :small_repo, files: { 'my_ci_file.yml' => 'test' }) }
-
- before do
- project.ci_config_path = 'my_ci_file.yml'
- end
-
- it { is_expected.to be_truthy }
- end
+ it { is_expected.to be_truthy }
end
- context 'when the FF ci_refactor_has_ci_config_file is disabled' do
+ context 'when the repository does not have a .gitlab-ci.yml file' do
+ let_it_be(:project) { create(:project, :small_repo, files: { 'README.md' => 'hello' }) }
+
+ it { is_expected.to be_falsey }
+ end
+
+ context 'when the repository has a custom CI config file' do
+ let_it_be(:project) { create(:project, :small_repo, files: { 'my_ci_file.yml' => 'test' }) }
+
before do
- stub_feature_flags(ci_refactor_has_ci_config_file: false)
+ project.ci_config_path = 'my_ci_file.yml'
end
- it_behaves_like '#has_ci_config_file?'
-
- context 'when the repository has a custom CI config file' do
- let_it_be(:project) { create(:project, :small_repo, files: { 'my_ci_file.yml' => 'test' }) }
-
- before do
- project.ci_config_path = 'my_ci_file.yml'
- end
-
- it { is_expected.to be_falsey }
- end
+ it { is_expected.to be_truthy }
end
end
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index e5374f92846..b6cb2464605 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -4072,20 +4072,6 @@ RSpec.describe Repository, feature_category: :source_code_management do
it { is_expected.to eq(::Gitlab::Git::SHA256_BLANK_SHA) }
end
-
- context 'when feature flag is disabled' do
- before do
- stub_feature_flags(determine_blank_ref_based_on_gitaly_object_format: false)
- end
-
- it { is_expected.to eq(::Gitlab::Git::SHA1_BLANK_SHA) }
-
- context 'for a SHA256 repository' do
- let_it_be(:project) { create(:project, :empty_repo, object_format: Repository::FORMAT_SHA256) }
-
- it { is_expected.to eq(::Gitlab::Git::SHA1_BLANK_SHA) }
- end
- end
end
context 'for missing repository' do
@@ -4094,14 +4080,6 @@ RSpec.describe Repository, feature_category: :source_code_management do
end
it { is_expected.to eq(::Gitlab::Git::SHA1_BLANK_SHA) }
-
- context 'when feature flag is disabled' do
- before do
- stub_feature_flags(determine_blank_ref_based_on_gitaly_object_format: false)
- end
-
- it { is_expected.to eq(::Gitlab::Git::SHA1_BLANK_SHA) }
- end
end
end
diff --git a/spec/policies/group_policy_spec.rb b/spec/policies/group_policy_spec.rb
index 4632fcca12a..f9712b9735d 100644
--- a/spec/policies/group_policy_spec.rb
+++ b/spec/policies/group_policy_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
using RSpec::Parameterized::TableSyntax
context 'public group with no user' do
- let(:group) { create(:group, :public, :crm_enabled) }
+ let(:group) { create(:group, :public) }
let(:current_user) { nil }
specify do
@@ -23,7 +23,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
end
context 'public group with user who is not a member' do
- let(:group) { create(:group, :public, :crm_enabled) }
+ let(:group) { create(:group, :public) }
let(:current_user) { create(:user) }
specify do
@@ -38,7 +38,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
end
context 'private group that has been invited to a public project and with no user' do
- let(:project) { create(:project, :public, group: create(:group, :crm_enabled)) }
+ let(:project) { create(:project, :public, group: create(:group)) }
let(:current_user) { nil }
before do
@@ -53,7 +53,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
end
context 'private group that has been invited to a public project and with a foreign user' do
- let(:project) { create(:project, :public, group: create(:group, :crm_enabled)) }
+ let(:project) { create(:project, :public, group: create(:group)) }
let(:current_user) { create(:user) }
before do
@@ -78,7 +78,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
it { expect_allowed(*(public_permissions - [:read_counts])) }
context 'in subgroups' do
- let(:subgroup) { create(:group, :private, :crm_enabled, parent: group) }
+ let(:subgroup) { create(:group, :private, parent: group) }
let(:project) { create(:project, namespace: subgroup) }
it { expect_allowed(*(public_permissions - [:read_counts])) }
@@ -274,7 +274,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
describe 'private nested group use the highest access level from the group and inherited permissions' do
let_it_be(:nested_group) do
- create(:group, :private, :owner_subgroup_creation_only, :crm_enabled, parent: group)
+ create(:group, :private, :owner_subgroup_creation_only, parent: group)
end
before_all do
@@ -378,7 +378,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
let(:current_user) { owner }
context 'when the group share_with_group_lock is enabled' do
- let(:group) { create(:group, :crm_enabled, share_with_group_lock: true, parent: parent) }
+ let(:group) { create(:group, share_with_group_lock: true, parent: parent) }
before do
group.add_owner(owner)
@@ -386,10 +386,10 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
context 'when the parent group share_with_group_lock is enabled' do
context 'when the group has a grandparent' do
- let(:parent) { create(:group, :crm_enabled, share_with_group_lock: true, parent: grandparent) }
+ let(:parent) { create(:group, share_with_group_lock: true, parent: grandparent) }
context 'when the grandparent share_with_group_lock is enabled' do
- let(:grandparent) { create(:group, :crm_enabled, share_with_group_lock: true) }
+ let(:grandparent) { create(:group, share_with_group_lock: true) }
context 'when the current_user owns the parent' do
before do
@@ -415,7 +415,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
end
context 'when the grandparent share_with_group_lock is disabled' do
- let(:grandparent) { create(:group, :crm_enabled) }
+ let(:grandparent) { create(:group) }
context 'when the current_user owns the parent' do
before do
@@ -432,7 +432,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
end
context 'when the group does not have a grandparent' do
- let(:parent) { create(:group, :crm_enabled, share_with_group_lock: true) }
+ let(:parent) { create(:group, share_with_group_lock: true) }
context 'when the current_user owns the parent' do
before do
@@ -449,7 +449,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
end
context 'when the parent group share_with_group_lock is disabled' do
- let(:parent) { create(:group, :crm_enabled) }
+ let(:parent) { create(:group) }
it { expect_allowed(:change_share_with_group_lock) }
end
@@ -905,14 +905,14 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
end
it_behaves_like 'clusterable policies' do
- let(:clusterable) { create(:group, :crm_enabled) }
+ let(:clusterable) { create(:group) }
let(:cluster) do
create(:cluster, :provided_by_gcp, :group, groups: [clusterable])
end
end
describe 'update_max_artifacts_size' do
- let(:group) { create(:group, :public, :crm_enabled) }
+ let(:group) { create(:group, :public) }
context 'when no user' do
let(:current_user) { nil }
@@ -942,7 +942,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
end
describe 'design activity' do
- let_it_be(:group) { create(:group, :public, :crm_enabled) }
+ let_it_be(:group) { create(:group, :public) }
let(:current_user) { nil }
@@ -1256,7 +1256,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
it_behaves_like 'Self-managed Core resource access tokens'
context 'support bot' do
- let_it_be_with_refind(:group) { create(:group, :private, :crm_enabled) }
+ let_it_be_with_refind(:group) { create(:group, :private) }
let_it_be(:current_user) { Users::Internal.support_bot }
before do
@@ -1266,7 +1266,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
it { expect_disallowed(:read_label) }
context 'when group hierarchy has a project with service desk enabled' do
- let_it_be(:subgroup) { create(:group, :private, :crm_enabled, parent: group) }
+ let_it_be(:subgroup) { create(:group, :private, parent: group) }
let_it_be(:project) { create(:project, group: subgroup, service_desk_enabled: true) }
it { expect_allowed(:read_label) }
@@ -1635,7 +1635,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do
let(:current_user) { owner }
before do
- group.crm_settings.update!(enabled: false)
+ create(:crm_settings, group: group, enabled: false)
end
it { is_expected.to be_disallowed(:read_crm_contact) }
diff --git a/spec/policies/issue_policy_spec.rb b/spec/policies/issue_policy_spec.rb
index 94b05e50ef6..6bcc42df418 100644
--- a/spec/policies/issue_policy_spec.rb
+++ b/spec/policies/issue_policy_spec.rb
@@ -489,7 +489,7 @@ RSpec.describe IssuePolicy, feature_category: :team_planning do
describe 'crm permissions' do
let(:user) { create(:user) }
- let(:subgroup) { create(:group, :crm_enabled, parent: create(:group, :crm_enabled)) }
+ let(:subgroup) { create(:group, parent: create(:group)) }
let(:project) { create(:project, group: subgroup) }
let(:issue) { create(:issue, project: project) }
let(:policies) { described_class.new(user, issue) }
@@ -522,7 +522,7 @@ RSpec.describe IssuePolicy, feature_category: :team_planning do
end
context 'when crm disabled on subgroup' do
- let(:subgroup) { create(:group, parent: create(:group, :crm_enabled)) }
+ let(:subgroup) { create(:group, :crm_disabled, parent: create(:group)) }
it 'is disallowed' do
subgroup.parent.add_reporter(user)
diff --git a/spec/requests/api/commit_statuses_spec.rb b/spec/requests/api/commit_statuses_spec.rb
index 9247d9366b2..c49e544c175 100644
--- a/spec/requests/api/commit_statuses_spec.rb
+++ b/spec/requests/api/commit_statuses_spec.rb
@@ -543,11 +543,12 @@ RSpec.describe API::CommitStatuses, :clean_gitlab_redis_cache, feature_category:
end
context 'with partitions', :ci_partitionable do
- let(:current_partition_id) { ci_testing_partition_id }
+ include Ci::PartitioningHelpers
+
+ let(:current_partition_id) { ci_testing_partition_id_for_check_constraints }
before do
- allow(Ci::Pipeline)
- .to receive(:current_partition_value) { current_partition_id }
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
it 'creates records in the current partition' do
diff --git a/spec/requests/api/graphql/crm/contacts_spec.rb b/spec/requests/api/graphql/crm/contacts_spec.rb
index 3ae19de63ed..b6785491388 100644
--- a/spec/requests/api/graphql/crm/contacts_spec.rb
+++ b/spec/requests/api/graphql/crm/contacts_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe 'getting CRM contacts', feature_category: :service_desk do
include GraphqlHelpers
let_it_be(:current_user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:contact_a) do
create(
diff --git a/spec/requests/api/graphql/mutations/branch_rules/destroy_spec.rb b/spec/requests/api/graphql/mutations/branch_rules/destroy_spec.rb
new file mode 100644
index 00000000000..d6093601f68
--- /dev/null
+++ b/spec/requests/api/graphql/mutations/branch_rules/destroy_spec.rb
@@ -0,0 +1,60 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Deleting a BranchRule', feature_category: :source_code_management do
+ include GraphqlHelpers
+
+ let_it_be(:current_user) { create(:user) }
+ let_it_be(:protected_branch) { create(:protected_branch) }
+ let_it_be(:project) { protected_branch.project }
+
+ let(:branch_rule) { Projects::BranchRule.new(project, protected_branch) }
+ let(:global_id) { branch_rule.to_global_id.to_s }
+ let(:mutation) { graphql_mutation(:branch_rule_delete, { id: global_id }) }
+ let(:mutation_response) { graphql_mutation_response(:branch_rule_delete) }
+
+ subject(:mutation_request) { post_graphql_mutation(mutation, current_user: current_user) }
+
+ context 'when the user does not have permission' do
+ it_behaves_like 'a mutation that returns top-level errors',
+ errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
+
+ it 'does not destroy the BranchRule' do
+ expect { mutation_request }.not_to change { ProtectedBranch.count }
+ end
+ end
+
+ context 'when the user has permission' do
+ before_all do
+ project.add_maintainer(current_user)
+ end
+
+ it 'destroys the BranchRule' do
+ expect { mutation_request }.to change { ProtectedBranch.count }.by(-1)
+ end
+
+ it 'returns an empty BranchRule' do
+ mutation_request
+
+ expect(mutation_response).to have_key('branchRule')
+ expect(mutation_response['branchRule']).to be_nil
+ end
+
+ context 'when an invalid global id is given' do
+ let(:global_id) { project.to_gid.to_s }
+ let(:error_message) { %("#{global_id}" does not represent an instance of Projects::BranchRule) }
+ let(:global_id_error) { a_hash_including('message' => a_string_including(error_message)) }
+
+ it 'returns an error' do
+ mutation_request
+
+ expect(graphql_errors).to include(global_id_error)
+ end
+
+ it 'does not destroy the BranchRule' do
+ expect { mutation_request }.not_to change { ProtectedBranch.count }
+ end
+ end
+ end
+end
diff --git a/spec/requests/api/graphql/mutations/issues/set_crm_contacts_spec.rb b/spec/requests/api/graphql/mutations/issues/set_crm_contacts_spec.rb
index cdab267162e..05e0c997557 100644
--- a/spec/requests/api/graphql/mutations/issues/set_crm_contacts_spec.rb
+++ b/spec/requests/api/graphql/mutations/issues/set_crm_contacts_spec.rb
@@ -6,8 +6,8 @@ RSpec.describe 'Setting issues crm contacts', feature_category: :service_desk do
include GraphqlHelpers
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
- let_it_be(:subgroup) { create(:group, :crm_enabled, parent: group) }
+ let_it_be(:group) { create(:group) }
+ let_it_be(:subgroup) { create(:group, parent: group) }
let_it_be(:project) { create(:project, group: subgroup) }
let_it_be(:contacts) { create_list(:contact, 4, group: group) }
@@ -129,7 +129,7 @@ RSpec.describe 'Setting issues crm contacts', feature_category: :service_desk do
end
context 'when the contact belongs to a different group' do
- let(:group2) { create(:group, :crm_enabled) }
+ let(:group2) { create(:group) }
let(:contact) { create(:contact, group: group2) }
let(:contact_ids) { [global_id_of(contact)] }
@@ -171,8 +171,10 @@ RSpec.describe 'Setting issues crm contacts', feature_category: :service_desk do
end
context 'when crm_enabled is false' do
- let(:issue) { create(:issue) }
- let(:initial_contacts) { [] }
+ let_it_be(:group2) { create(:group, :crm_disabled) }
+ let_it_be(:project2) { create(:project, group: group2) }
+ let_it_be(:issue) { create(:issue, project: project2) }
+ let_it_be(:initial_contacts) { [] }
it 'raises expected error' do
issue.project.add_reporter(user)
diff --git a/spec/requests/groups/crm/contacts_controller_spec.rb b/spec/requests/groups/crm/contacts_controller_spec.rb
index 4916ce60108..48e9bfe6ef0 100644
--- a/spec/requests/groups/crm/contacts_controller_spec.rb
+++ b/spec/requests/groups/crm/contacts_controller_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe Groups::Crm::ContactsController, feature_category: :team_planning
shared_examples 'ok response with index template if authorized' do
context 'private group' do
- let(:group) { create(:group, :private, :crm_enabled) }
+ let(:group) { create(:group, :private) }
context 'with authorized user' do
before do
@@ -37,13 +37,13 @@ RSpec.describe Groups::Crm::ContactsController, feature_category: :team_planning
end
context 'when crm_enabled is false' do
- let(:group) { create(:group, :private) }
+ let(:group) { create(:group, :private, :crm_disabled) }
it_behaves_like 'response with 404 status'
end
context 'when subgroup' do
- let(:group) { create(:group, :private, :crm_enabled, parent: create(:group)) }
+ let(:group) { create(:group, :private, parent: create(:group)) }
it_behaves_like 'response with 404 status'
end
@@ -68,7 +68,7 @@ RSpec.describe Groups::Crm::ContactsController, feature_category: :team_planning
end
context 'public group' do
- let(:group) { create(:group, :public, :crm_enabled) }
+ let(:group) { create(:group, :public) }
context 'with anonymous user' do
it_behaves_like 'response with 404 status'
diff --git a/spec/requests/groups/crm/organizations_controller_spec.rb b/spec/requests/groups/crm/organizations_controller_spec.rb
index 3e7e9a8e878..c180365ae55 100644
--- a/spec/requests/groups/crm/organizations_controller_spec.rb
+++ b/spec/requests/groups/crm/organizations_controller_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe Groups::Crm::OrganizationsController, feature_category: :team_pla
shared_examples 'ok response with index template if authorized' do
context 'private group' do
- let(:group) { create(:group, :private, :crm_enabled) }
+ let(:group) { create(:group, :private) }
context 'with authorized user' do
before do
@@ -37,13 +37,13 @@ RSpec.describe Groups::Crm::OrganizationsController, feature_category: :team_pla
end
context 'when crm_enabled is false' do
- let(:group) { create(:group, :private) }
+ let(:group) { create(:group, :private, :crm_disabled) }
it_behaves_like 'response with 404 status'
end
context 'when subgroup' do
- let(:group) { create(:group, :private, :crm_enabled, parent: create(:group)) }
+ let(:group) { create(:group, :private, parent: create(:group)) }
it_behaves_like 'response with 404 status'
end
@@ -68,7 +68,7 @@ RSpec.describe Groups::Crm::OrganizationsController, feature_category: :team_pla
end
context 'public group' do
- let(:group) { create(:group, :public, :crm_enabled) }
+ let(:group) { create(:group, :public) }
context 'with anonymous user' do
it_behaves_like 'response with 404 status'
diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb
index 0dbe9cdec71..899d17879ef 100644
--- a/spec/requests/users_controller_spec.rb
+++ b/spec/requests/users_controller_spec.rb
@@ -589,8 +589,6 @@ RSpec.describe UsersController, feature_category: :user_management do
aimed_for_deletion_project.add_developer(private_user)
create(:push_event, project: project, author: author)
create(:push_event, project: aimed_for_deletion_project, author: author)
-
- subject
end
shared_examples_for 'renders contributed projects' do
@@ -604,6 +602,10 @@ RSpec.describe UsersController, feature_category: :user_management do
context "with format: #{format}" do
let(:format) { format }
+ before do
+ subject
+ end
+
context 'with public profile' do
let(:author) { public_user }
@@ -632,6 +634,30 @@ RSpec.describe UsersController, feature_category: :user_management do
end
end
end
+
+ describe 'pagination' do
+ let(:author) { public_user }
+ let(:format) { :json }
+ let(:per_page_limit) { 2 }
+
+ before do
+ allow(Kaminari.config).to receive(:default_per_page).and_return(per_page_limit)
+
+ create_list(:project, per_page_limit + 1, :public, :small_repo).each do |small_project|
+ small_project.add_developer(author)
+ create(:push_event, project: small_project, author: author)
+ end
+
+ subject
+ end
+
+ it_behaves_like 'renders contributed projects'
+
+ it 'paginates without count' do
+ expect(assigns(:contributed_projects).size).to eq(per_page_limit)
+ expect(assigns(:contributed_projects)).to be_a(Kaminari::PaginatableWithoutCount)
+ end
+ end
end
describe 'GET #starred' do
diff --git a/spec/serializers/issue_sidebar_basic_entity_spec.rb b/spec/serializers/issue_sidebar_basic_entity_spec.rb
index ef80bcd5eb1..a7e7730516a 100644
--- a/spec/serializers/issue_sidebar_basic_entity_spec.rb
+++ b/spec/serializers/issue_sidebar_basic_entity_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe IssueSidebarBasicEntity do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, :repository, group: group) }
let_it_be(:user) { create(:user, developer_projects: [project]) }
let_it_be_with_reload(:issue) { create(:issue, project: project, assignees: [user]) }
@@ -99,7 +99,7 @@ RSpec.describe IssueSidebarBasicEntity do
end
context 'with crm enabled' do
- let(:subgroup) { create(:group, :crm_enabled, parent: group) }
+ let(:subgroup) { create(:group, parent: group) }
it 'is true' do
allow(CustomerRelations::Contact).to receive(:exists_for_group?).with(group).and_return(true)
@@ -109,7 +109,7 @@ RSpec.describe IssueSidebarBasicEntity do
end
context 'with crm disabled' do
- let(:subgroup) { create(:group, parent: group) }
+ let(:subgroup) { create(:group, :crm_disabled, parent: group) }
it 'is false' do
allow(CustomerRelations::Contact).to receive(:exists_for_group?).with(group).and_return(true)
diff --git a/spec/services/ci/create_commit_status_service_spec.rb b/spec/services/ci/create_commit_status_service_spec.rb
index ec200e24c8f..3c7346e3e2e 100644
--- a/spec/services/ci/create_commit_status_service_spec.rb
+++ b/spec/services/ci/create_commit_status_service_spec.rb
@@ -404,12 +404,13 @@ RSpec.describe Ci::CreateCommitStatusService, :clean_gitlab_redis_cache, feature
end
context 'with partitions', :ci_partitionable do
- let(:current_partition_id) { ci_testing_partition_id }
+ include Ci::PartitioningHelpers
+
+ let(:current_partition_id) { ci_testing_partition_id_for_check_constraints }
let(:params) { { state: 'running' } }
before do
- allow(Ci::Pipeline)
- .to receive(:current_partition_value) { current_partition_id }
+ stub_current_partition_id(ci_testing_partition_id_for_check_constraints)
end
it 'creates records in the current partition' do
diff --git a/spec/services/customer_relations/contacts/create_service_spec.rb b/spec/services/customer_relations/contacts/create_service_spec.rb
index 91aa51385e7..ac973f4a14b 100644
--- a/spec/services/customer_relations/contacts/create_service_spec.rb
+++ b/spec/services/customer_relations/contacts/create_service_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe CustomerRelations::Contacts::CreateService, feature_category: :se
subject(:response) { described_class.new(group: group, current_user: user, params: params).execute }
context 'when user does not have permission' do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
before_all do
group.add_reporter(user)
@@ -25,7 +25,7 @@ RSpec.describe CustomerRelations::Contacts::CreateService, feature_category: :se
end
context 'when user has permission' do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
before_all do
group.add_developer(user)
diff --git a/spec/services/customer_relations/contacts/update_service_spec.rb b/spec/services/customer_relations/contacts/update_service_spec.rb
index 105b5bad5f7..3dc1ddc5ab6 100644
--- a/spec/services/customer_relations/contacts/update_service_spec.rb
+++ b/spec/services/customer_relations/contacts/update_service_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe CustomerRelations::Contacts::UpdateService, feature_category: :se
describe '#execute' do
context 'when the user has no permission' do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let(:params) { { first_name: 'Gary' } }
@@ -24,7 +24,7 @@ RSpec.describe CustomerRelations::Contacts::UpdateService, feature_category: :se
end
context 'when user has permission' do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
before_all do
group.add_developer(user)
diff --git a/spec/services/customer_relations/organizations/create_service_spec.rb b/spec/services/customer_relations/organizations/create_service_spec.rb
index 8748fe44763..0c313f7f925 100644
--- a/spec/services/customer_relations/organizations/create_service_spec.rb
+++ b/spec/services/customer_relations/organizations/create_service_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe CustomerRelations::Organizations::CreateService, feature_category
describe '#execute' do
let_it_be(:user) { create(:user) }
- let(:group) { create(:group, :crm_enabled) }
+ let(:group) { create(:group) }
let(:params) { attributes_for(:crm_organization, group: group) }
subject(:response) { described_class.new(group: group, current_user: user, params: params).execute }
diff --git a/spec/services/customer_relations/organizations/update_service_spec.rb b/spec/services/customer_relations/organizations/update_service_spec.rb
index f11b99b101e..0d8c6613400 100644
--- a/spec/services/customer_relations/organizations/update_service_spec.rb
+++ b/spec/services/customer_relations/organizations/update_service_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe CustomerRelations::Organizations::UpdateService, feature_category
describe '#execute' do
context 'when the user has no permission' do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let(:params) { { name: 'GitLab' } }
@@ -24,7 +24,7 @@ RSpec.describe CustomerRelations::Organizations::UpdateService, feature_category
end
context 'when user has permission' do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
before_all do
group.add_developer(user)
diff --git a/spec/services/gravatar_service_spec.rb b/spec/services/gravatar_service_spec.rb
index 6ccb362cc5c..7fad688d355 100644
--- a/spec/services/gravatar_service_spec.rb
+++ b/spec/services/gravatar_service_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe GravatarService, feature_category: :user_profile do
it 'replaces the placeholders' do
avatar_url = described_class.new.execute('user@example.com', 100, 2, username: 'user')
- expect(avatar_url).to include("hash=#{Digest::MD5.hexdigest('user@example.com')}")
+ expect(avatar_url).to include("hash=#{Digest::SHA256.hexdigest('user@example.com')}")
expect(avatar_url).to include("size=200")
expect(avatar_url).to include("email=user%40example.com")
expect(avatar_url).to include("username=user")
diff --git a/spec/services/groups/transfer_service_spec.rb b/spec/services/groups/transfer_service_spec.rb
index ce67c4c51fe..8a866b632bd 100644
--- a/spec/services/groups/transfer_service_spec.rb
+++ b/spec/services/groups/transfer_service_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe Groups::TransferService, :sidekiq_inline, feature_category: :grou
end
let_it_be(:user) { create(:user) }
- let_it_be(:new_parent_group) { create(:group, :public, :crm_enabled) }
+ let_it_be(:new_parent_group) { create(:group, :public) }
let!(:group_member) { create(:group_member, :owner, group: group, user: user) }
let(:transfer_service) { described_class.new(group, user) }
diff --git a/spec/services/groups/update_service_spec.rb b/spec/services/groups/update_service_spec.rb
index 0d160911eab..7ac3382672d 100644
--- a/spec/services/groups/update_service_spec.rb
+++ b/spec/services/groups/update_service_spec.rb
@@ -150,29 +150,29 @@ RSpec.describe Groups::UpdateService, feature_category: :groups_and_projects do
context 'crm_enabled param' do
context 'when no existing crm_settings' do
- it 'when param not present, leave crm disabled' do
+ it 'when param not present, leave crm enabled' do
params = {}
described_class.new(public_group, user, params).execute
updated_group = public_group.reload
- expect(updated_group.crm_enabled?).to be_falsey
- end
-
- it 'when param set true, enables crm' do
- params = { crm_enabled: true }
-
- described_class.new(public_group, user, params).execute
- updated_group = public_group.reload
-
expect(updated_group.crm_enabled?).to be_truthy
end
+
+ it 'when param set false, disables crm' do
+ params = { crm_enabled: false }
+
+ described_class.new(public_group, user, params).execute
+ updated_group = public_group.reload
+
+ expect(updated_group.crm_enabled?).to be_falsy
+ end
end
context 'with existing crm_settings' do
it 'when param set true, enables crm' do
params = { crm_enabled: true }
- create(:crm_settings, group: public_group)
+ create(:crm_settings, group: public_group, enabled: false)
described_class.new(public_group, user, params).execute
@@ -192,7 +192,7 @@ RSpec.describe Groups::UpdateService, feature_category: :groups_and_projects do
it 'when param not present, crm remains disabled' do
params = {}
- create(:crm_settings, group: public_group)
+ create(:crm_settings, group: public_group, enabled: false)
described_class.new(public_group, user, params).execute
diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb
index 7cd2cd8f564..2e662567952 100644
--- a/spec/services/issues/create_service_spec.rb
+++ b/spec/services/issues/create_service_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Issues::CreateService, feature_category: :team_planning do
include AfterNextHelpers
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be_with_reload(:project) { create(:project, :public, group: group) }
let_it_be(:user) { create(:user) }
diff --git a/spec/services/issues/set_crm_contacts_service_spec.rb b/spec/services/issues/set_crm_contacts_service_spec.rb
index 7d709bbd9c8..5ff16dbeda1 100644
--- a/spec/services/issues/set_crm_contacts_service_spec.rb
+++ b/spec/services/issues/set_crm_contacts_service_spec.rb
@@ -4,8 +4,8 @@ require 'spec_helper'
RSpec.describe Issues::SetCrmContactsService, feature_category: :team_planning do
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group, :crm_enabled) }
- let_it_be(:project) { create(:project, group: create(:group, :crm_enabled, parent: group)) }
+ let_it_be(:group) { create(:group) }
+ let_it_be(:project) { create(:project, group: create(:group, parent: group)) }
let_it_be(:contacts) { create_list(:contact, 4, group: group) }
let_it_be(:issue, reload: true) { create(:issue, project: project) }
let_it_be(:issue_contact_1) do
@@ -60,7 +60,7 @@ RSpec.describe Issues::SetCrmContactsService, feature_category: :team_planning d
context 'but the crm setting is disabled' do
let(:params) { { replace_ids: [contacts[1].id, contacts[2].id] } }
- let(:subgroup_with_crm_disabled) { create(:group, parent: group) }
+ let(:subgroup_with_crm_disabled) { create(:group, :crm_disabled, parent: group) }
let(:project_with_crm_disabled) { create(:project, group: subgroup_with_crm_disabled) }
let(:issue_with_crm_disabled) { create(:issue, project: project_with_crm_disabled) }
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb
index e8bcdc2c44b..f6cbacaf760 100644
--- a/spec/services/issues/update_service_spec.rb
+++ b/spec/services/issues/update_service_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe Issues::UpdateService, :mailer, feature_category: :team_planning
let_it_be(:user2) { create(:user) }
let_it_be(:user3) { create(:user) }
let_it_be(:guest) { create(:user) }
- let_it_be(:group) { create(:group, :public, :crm_enabled) }
+ let_it_be(:group) { create(:group, :public) }
let_it_be(:project, reload: true) { create(:project, :repository, group: group) }
let_it_be(:label) { create(:label, title: 'a', project: project) }
let_it_be(:label2) { create(:label, title: 'b', project: project) }
diff --git a/spec/services/projects/autocomplete_service_spec.rb b/spec/services/projects/autocomplete_service_spec.rb
index 4bfbb1e3dd2..0ec6362761e 100644
--- a/spec/services/projects/autocomplete_service_spec.rb
+++ b/spec/services/projects/autocomplete_service_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Projects::AutocompleteService, feature_category: :groups_and_projects do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, :public, group: group) }
let_it_be(:owner) { create(:user) }
let_it_be(:issue) { create(:issue, project: project, title: 'Issue 1') }
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb
index 2f1443cc297..4ea3467e33c 100644
--- a/spec/services/quick_actions/interpret_service_spec.rb
+++ b/spec/services/quick_actions/interpret_service_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe QuickActions::InterpretService, feature_category: :team_planning do
include AfterNextHelpers
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:public_project) { create(:project, :public, group: group) }
let_it_be(:repository_project) { create(:project, :repository) }
let_it_be(:project) { public_project }
diff --git a/spec/support/helpers/database/duplicate_indexes.yml b/spec/support/helpers/database/duplicate_indexes.yml
index 6162c1f0791..55531f46c70 100644
--- a/spec/support/helpers/database/duplicate_indexes.yml
+++ b/spec/support/helpers/database/duplicate_indexes.yml
@@ -99,6 +99,13 @@ ml_models:
p_ci_runner_machine_builds:
index_p_ci_runner_machine_builds_on_runner_machine_id:
- index_ci_runner_machine_builds_on_runner_machine_id
+p_ci_job_artifacts:
+ p_ci_job_artifacts_project_id_file_type_id_idx:
+ - p_ci_job_artifacts_project_id_idx
+ p_ci_job_artifacts_project_id_created_at_id_idx:
+ - p_ci_job_artifacts_project_id_idx
+ p_ci_job_artifacts_project_id_id_idx1:
+ - p_ci_job_artifacts_project_id_idx
pages_domains:
index_pages_domains_on_project_id_and_enabled_until:
- index_pages_domains_on_project_id
diff --git a/spec/support/helpers/database/inject_failure_helpers.rb b/spec/support/helpers/database/inject_failure_helpers.rb
index df98f45e69f..25b4d2a6f87 100644
--- a/spec/support/helpers/database/inject_failure_helpers.rb
+++ b/spec/support/helpers/database/inject_failure_helpers.rb
@@ -30,6 +30,14 @@ module Database
end
end
+ def fail_adding_concurrent_fk(from_table, to_table)
+ proc do
+ allow(migration_context).to receive(:add_concurrent_foreign_key).and_call_original
+ expect(migration_context).to receive(:add_concurrent_foreign_key).with(from_table, to_table, any_args)
+ .and_wrap_original(&fail_first_time)
+ end
+ end
+
def fail_removing_fk(from_table, to_table)
proc do
allow(migration_context.connection).to receive(:remove_foreign_key).and_call_original
diff --git a/spec/support/shared_contexts/navbar_structure_context.rb b/spec/support/shared_contexts/navbar_structure_context.rb
index 9188fa08335..1f958734bad 100644
--- a/spec/support/shared_contexts/navbar_structure_context.rb
+++ b/spec/support/shared_contexts/navbar_structure_context.rb
@@ -149,6 +149,16 @@ RSpec.shared_context 'group navbar structure' do
[_("Issues"), _("Issue board"), _("Milestones"), (_('Iterations') if Gitlab.ee?)]
end
+ let(:customer_relations_nav_item) do
+ {
+ nav_item: _('Customer relations'),
+ nav_sub_items: [
+ _('Contacts'),
+ _('Organizations')
+ ]
+ }
+ end
+
let(:structure) do
[
{
diff --git a/spec/support/shared_contexts/policies/group_policy_shared_context.rb b/spec/support/shared_contexts/policies/group_policy_shared_context.rb
index 094a78aa45f..509bc413b8d 100644
--- a/spec/support/shared_contexts/policies/group_policy_shared_context.rb
+++ b/spec/support/shared_contexts/policies/group_policy_shared_context.rb
@@ -8,7 +8,7 @@ RSpec.shared_context 'GroupPolicy context' do
let_it_be(:owner) { create(:user) }
let_it_be(:admin) { create(:admin) }
let_it_be(:non_group_member) { create(:user) }
- let_it_be(:group, refind: true) { create(:group, :private, :owner_subgroup_creation_only, :crm_enabled) }
+ let_it_be(:group, refind: true) { create(:group, :private, :owner_subgroup_creation_only) }
let(:public_permissions) do
%i[
diff --git a/spec/views/shared/issuable/_sidebar.html.haml_spec.rb b/spec/views/shared/issuable/_sidebar.html.haml_spec.rb
index 31f79c25073..a8307cc536e 100644
--- a/spec/views/shared/issuable/_sidebar.html.haml_spec.rb
+++ b/spec/views/shared/issuable/_sidebar.html.haml_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe 'shared/issuable/_sidebar.html.haml' do
end
context 'project in a group' do
- let_it_be(:group) { create(:group, :crm_enabled) }
+ let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:incident) { create(:incident, project: project) }