Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-12-01 21:08:18 +00:00
parent 4e3a998b8e
commit 61666f277a
73 changed files with 261 additions and 289 deletions

View File

@ -0,0 +1,30 @@
## Summary
<!-- Summarize the bug encountered concisely. -->
## Steps to reproduce
<!-- Describe how one can reproduce the issue - this is very important. Please use an ordered list. -->
## What is the current *bug* behavior?
<!-- Describe what actually happens. -->
## What is the expected *correct* behavior?
<!-- Describe what you should see instead. -->
## Relevant logs and/or screenshots
<!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code
as it's tough to read otherwise. -->
## Possible fixes
<!-- If you can, link to the line of code that might be responsible for the problem. -->
<!-- Please add a label for the type of bug as per https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification -->
/label ~"type::bug"
/label ~"group::global search"
/label ~"workflow::solution validation"
/milestone %Backlog

View File

@ -0,0 +1,13 @@
## Problem to solve
<!-- What problem do we solve? Try to define the who/what/why of the opportunity as a user story. For example, "As a (who), I want (what), so I can (why/value)." -->
## Proposal
<!-- Use this section to explain the feature and how it will work. It can be helpful to add technical details, design proposals, and links to related epics or issues. -->
<!-- Please add a label for the type of feature as per https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification -->
/label ~"type::feature"
/label ~"group::global search"
/label ~"workflow::solution validation"
/milestone %Backlog

View File

@ -0,0 +1,11 @@
## Background
## Proposal
<!-- Use this section to explain the feature and how it will work. It can be helpful to add technical details, design proposals, and links to related epics or issues. -->
<!-- Please add a label for the type of maintenance as per https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification -->
/label ~"type::maintenance"
/label ~"group::global search"
/label ~"workflow::solution validation"
/milestone %Backlog

View File

@ -1,12 +0,0 @@
---
# Cop supports --autocorrect.
Performance/RedundantBlockCall:
Exclude:
- 'ee/app/models/gitlab_subscription.rb'
- 'ee/lib/ee/gitlab/auth/ldap/sync/proxy.rb'
- 'lib/gitlab/auth/ldap/access.rb'
- 'lib/gitlab/auth/ldap/adapter.rb'
- 'lib/gitlab/database/bulk_update.rb'
- 'lib/gitlab/http.rb'
- 'lib/gitlab/safe_request_store.rb'
- 'lib/gitlab/timeless.rb'

View File

@ -1,24 +0,0 @@
---
# Cop supports --autocorrect.
RSpec/SharedExamples:
Exclude:
- 'ee/spec/lib/ee/gitlab/auth/ldap/sync/group_spec.rb'
- 'ee/spec/lib/ee/gitlab/email/handler/service_desk_handler_spec.rb'
- 'ee/spec/lib/gitlab/email/handler/create_note_handler_spec.rb'
- 'ee/spec/services/approval_rules/params_filtering_service_spec.rb'
- 'spec/lib/banzai/filter/repository_link_filter_spec.rb'
- 'spec/lib/gitlab/asciidoc_spec.rb'
- 'spec/lib/gitlab/email/handler/create_issue_handler_spec.rb'
- 'spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb'
- 'spec/lib/gitlab/email/handler/create_note_handler_spec.rb'
- 'spec/lib/gitlab/email/handler/create_note_on_issuable_handler_spec.rb'
- 'spec/lib/gitlab/email/handler/service_desk_handler_spec.rb'
- 'spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb'
- 'spec/lib/gitlab/email/receiver_spec.rb'
- 'spec/lib/gitlab/git/tree_spec.rb'
- 'spec/models/design_management/version_spec.rb'
- 'spec/models/integrations/drone_ci_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/requests/api/graphql/project/issue/design_collection/version_spec.rb'
- 'spec/rubocop/cop/performance/readlines_each_spec.rb'
- 'spec/support/shared_contexts/email_shared_context.rb'

View File

@ -2,56 +2,6 @@
# Cop supports --autocorrect.
Style/RedundantInterpolation:
Exclude:
- 'app/components/diffs/stats_component.rb'
- 'app/helpers/blob_helper.rb'
- 'app/helpers/ci/runners_helper.rb'
- 'app/helpers/commits_helper.rb'
- 'app/helpers/dropdowns_helper.rb'
- 'app/helpers/environments_helper.rb'
- 'app/helpers/icons_helper.rb'
- 'app/helpers/issuables_helper.rb'
- 'app/helpers/nav_helper.rb'
- 'app/helpers/projects_helper.rb'
- 'app/helpers/search_helper.rb'
- 'app/helpers/tooling/visual_review_helper.rb'
- 'app/models/concerns/issuable.rb'
- 'app/models/integrations/base_chat_notification.rb'
- 'app/models/integrations/pushover.rb'
- 'app/models/merge_request.rb'
- 'app/services/jira_import/start_import_service.rb'
- 'app/services/users/approve_service.rb'
- 'app/services/users/banned_user_base_service.rb'
- 'app/services/users/reject_service.rb'
- 'db/post_migrate/20220420214703_schedule_backfill_draft_status_on_merge_requests_corrected_regex.rb'
- 'ee/app/graphql/types/compliance_management/merge_requests/compliance_violation_reason_enum.rb'
- 'ee/app/graphql/types/incident_management/oncall_rotation_length_unit_enum.rb'
- 'ee/app/helpers/ee/ci/runners_helper.rb'
- 'ee/app/helpers/ee/geo_helper.rb'
- 'ee/app/services/geo/event_store.rb'
- 'ee/app/services/geo/repository_updated_service.rb'
- 'ee/db/fixtures/development/31_devops_adoption.rb'
- 'ee/lib/gitlab/insights/serializers/chartjs/base_serializer.rb'
- 'ee/spec/features/epics/epic_issues_spec.rb'
- 'ee/spec/features/projects/requirements_management/requirements_list_spec.rb'
- 'ee/spec/features/registrations/one_trust_spec.rb'
- 'ee/spec/graphql/ee/mutations/boards/lists/create_spec.rb'
- 'ee/spec/lib/banzai/filter/issuable_reference_expansion_filter_spec.rb'
- 'ee/spec/lib/banzai/filter/references/iteration_reference_filter_spec.rb'
- 'ee/spec/lib/ee/gitlab/import_export/group/tree_saver_spec.rb'
- 'ee/spec/lib/gitlab/insights/serializers/chartjs/line_serializer_spec.rb'
- 'ee/spec/lib/gitlab/insights/serializers/chartjs/multi_series_serializer_spec.rb'
- 'ee/spec/mailers/ci_minutes_usage_mailer_spec.rb'
- 'ee/spec/mailers/emails/namespace_storage_usage_mailer_spec.rb'
- 'ee/spec/mailers/notify_spec.rb'
- 'ee/spec/models/incident_management/issuable_escalation_status_spec.rb'
- 'ee/spec/requests/api/issues_spec.rb'
- 'ee/spec/requests/api/search_spec.rb'
- 'ee/spec/services/analytics/cycle_analytics/consistency_check_service_spec.rb'
- 'ee/spec/services/search_service_spec.rb'
- 'ee/spec/services/timebox_report_service_spec.rb'
- 'ee/spec/support/shared_contexts/lib/gitlab/insights/serializers/serializers_shared_context.rb'
- 'ee/spec/support/shared_examples/lib/gitlab/elastic/standalone_indices_shared_examples.rb'
- 'ee/spec/tasks/gitlab/elastic_rake_spec.rb'
- 'lib/backup/manager.rb'
- 'lib/backup/task.rb'
- 'lib/gitlab/application_rate_limiter.rb'

View File

@ -1,5 +1,5 @@
<script>
import { GlListbox } from '@gitlab/ui';
import { GlCollapsibleListbox } from '@gitlab/ui';
import { s__ } from '~/locale';
import { setUrlParams, visitUrl } from '~/lib/utils/url_utility';
@ -9,7 +9,7 @@ export default {
database: s__('BackgroundMigrations|Database'),
},
components: {
GlListbox,
GlCollapsibleListbox,
},
props: {
databases: {
@ -39,7 +39,7 @@ export default {
<label id="label" class="gl-font-weight-bold gl-mr-4 gl-mb-0">{{
$options.i18n.database
}}</label>
<gl-listbox
<gl-collapsible-listbox
v-model="selected"
:items="databases"
right

View File

@ -1,11 +1,11 @@
<script>
import { GlListbox } from '@gitlab/ui';
import { GlCollapsibleListbox } from '@gitlab/ui';
import { setCookie } from '~/lib/utils/common_utils';
import { PREFERRED_LANGUAGE_COOKIE_KEY } from '../constants';
export default {
components: {
GlListbox,
GlCollapsibleListbox,
},
inject: {
locales: {
@ -29,7 +29,7 @@ export default {
};
</script>
<template>
<gl-listbox
<gl-collapsible-listbox
v-model="selected"
:toggle-text="preferredLocale.text"
:items="locales"
@ -45,5 +45,5 @@ export default {
{{ locale.text }}
</span>
</template>
</gl-listbox>
</gl-collapsible-listbox>
</template>

View File

@ -1,4 +1,4 @@
import { GlListbox } from '@gitlab/ui';
import { GlCollapsibleListbox } from '@gitlab/ui';
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
@ -31,7 +31,7 @@ export function initListbox(el, { onChange } = {}) {
},
},
render(h) {
return h(GlListbox, {
return h(GlCollapsibleListbox, {
props: {
items,
right,

View File

@ -2,7 +2,7 @@ import { initListbox } from '~/listbox';
import { redirectTo } from '~/lib/utils/url_utility';
/**
* Instantiates GlListbox components with redirect behavior for tags created
* Instantiates GlCollapsibleListbox components with redirect behavior for tags created
* with the `gl_redirect_listbox_tag` HAML helper.
*
* NOTE: Do not import this script explicitly. Using `gl_redirect_listbox_tag`

View File

@ -1,5 +1,5 @@
<script>
import { GlAvatarLabeled, GlListbox } from '@gitlab/ui';
import { GlAvatarLabeled, GlCollapsibleListbox } from '@gitlab/ui';
import { __ } from '~/locale';
import searchUsersQuery from '~/graphql_shared/queries/users_search_all.query.graphql';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
@ -11,7 +11,7 @@ const USERS_PER_PAGE = 20;
export default {
components: {
GlAvatarLabeled,
GlListbox,
GlCollapsibleListbox,
},
props: {
name: {
@ -70,7 +70,7 @@ export default {
</script>
<template>
<div>
<gl-listbox
<gl-collapsible-listbox
ref="listbox"
v-model="user"
:items="users"
@ -89,7 +89,7 @@ export default {
:sub-label="item.username"
/>
</template>
</gl-listbox>
</gl-collapsible-listbox>
<input type="hidden" :name="name" :value="userId" />
</div>
</template>

View File

@ -1,6 +1,6 @@
<script>
import { debounce } from 'lodash';
import { GlListbox } from '@gitlab/ui';
import { GlCollapsibleListbox } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils';
import Api from '~/api';
import { __ } from '~/locale';
@ -18,7 +18,7 @@ const MINIMUM_QUERY_LENGTH = 3;
export default {
components: {
GlListbox,
GlCollapsibleListbox,
},
props: {
inputName: {
@ -167,7 +167,7 @@ export default {
<template>
<div>
<gl-listbox
<gl-collapsible-listbox
ref="listbox"
v-model="selected"
:header-text="$options.i18n.selectGroup"
@ -188,7 +188,7 @@ export default {
</div>
<div class="gl-text-gray-300">{{ item.full_path }}</div>
</template>
</gl-listbox>
</gl-collapsible-listbox>
<div class="flash-container"></div>
<input :id="inputId" data-testid="input" type="hidden" :name="inputName" :value="inputValue" />
</div>

View File

@ -19,7 +19,7 @@ module Diffs
name: f.file_path,
path: diff_file_path_text(f),
icon: diff_file_changed_icon(f),
iconColor: "#{diff_file_changed_icon_color(f)}",
iconColor: diff_file_changed_icon_color(f).to_s,
added: f.added_lines,
removed: f.removed_lines
}

View File

@ -295,7 +295,7 @@ module BlobHelper
end
def edit_link_tag(link_text, edit_path, common_classes)
link_to link_text, edit_path, class: "#{common_classes}"
link_to link_text, edit_path, class: common_classes
end
def edit_button_tag(blob, common_classes, text, edit_path, project, ref)

View File

@ -96,8 +96,8 @@ module Ci
def toggle_shared_runners_settings_data(project)
{
is_enabled: "#{project.shared_runners_enabled?}",
is_disabled_and_unoverridable: "#{project.group&.shared_runners_setting == Namespace::SR_DISABLED_AND_UNOVERRIDABLE}",
is_enabled: project.shared_runners_enabled?.to_s,
is_disabled_and_unoverridable: (project.group&.shared_runners_setting == Namespace::SR_DISABLED_AND_UNOVERRIDABLE).to_s,
update_path: toggle_shared_runners_project_runners_path(project)
}
end

View File

@ -124,7 +124,7 @@ module CommitsHelper
new_project_tag_path: new_project_tag_path(project, ref: commit),
email_patches_path: project_commit_path(project, commit, format: :patch),
plain_diff_path: project_commit_path(project, commit, format: :diff),
can_revert: "#{can_collaborate && !commit.has_been_reverted?(current_user)}",
can_revert: (can_collaborate && !commit.has_been_reverted?(current_user)).to_s,
can_cherry_pick: can_collaborate.to_s,
can_tag: can?(current_user, :push_code, project).to_s,
can_email_patches: (commit.parents.length < 2).to_s

View File

@ -17,8 +17,8 @@ module DropdownsHelper
end
content_tag_options = { class: "dropdown-menu dropdown-select #{options[:dropdown_class] if options.key?(:dropdown_class)}" }
content_tag_options[:data] = options[:dropdown_qa_selector] ? { qa_selector: "#{options[:dropdown_qa_selector]}" } : {}
content_tag_options[:data][:testid] = "#{options[:dropdown_testid]}" if options[:dropdown_testid]
content_tag_options[:data] = options[:dropdown_qa_selector] ? { qa_selector: (options[:dropdown_qa_selector]).to_s } : {}
content_tag_options[:data][:testid] = (options[:dropdown_testid]).to_s if options[:dropdown_testid]
dropdown_output << content_tag(:div, content_tag_options) do
output = []

View File

@ -67,7 +67,7 @@ module EnvironmentsHelper
'external_dashboard_url' => project.metrics_setting_external_dashboard_url,
'custom_metrics_path' => project_prometheus_metrics_path(project),
'validate_query_path' => validate_query_project_prometheus_metrics_path(project),
'custom_metrics_available' => "#{custom_metrics_available?(project)}",
'custom_metrics_available' => custom_metrics_available?(project).to_s,
'dashboard_timezone' => project.metrics_setting_dashboard_timezone.to_s.upcase
}
end
@ -78,8 +78,8 @@ module EnvironmentsHelper
{
'metrics_dashboard_base_path' => metrics_dashboard_base_path(environment, project),
'current_environment_name' => environment.name,
'has_metrics' => "#{environment.has_metrics?}",
'environment_state' => "#{environment.state}"
'has_metrics' => environment.has_metrics?.to_s,
'environment_state' => environment.state.to_s
}
end

View File

@ -38,7 +38,7 @@ module IconsHelper
css_classes = []
css_classes << "s#{size}" if size
css_classes << "#{css_class}" unless css_class.blank?
css_classes << css_class.to_s unless css_class.blank?
content_tag(
:svg,

View File

@ -138,14 +138,14 @@ module IssuablesHelper
def issuable_meta_author_status(author)
return "" unless author&.status&.customized? && status = user_status(author)
"#{status}".html_safe
status.to_s.html_safe
end
def issuable_meta(issuable, project)
output = []
if issuable.respond_to?(:work_item_type) && WorkItems::Type::WI_TYPES_WITH_CREATED_HEADER.include?(issuable.work_item_type.base_type)
output << content_tag(:span, sprite_icon("#{issuable.work_item_type.icon_name}", css_class: 'gl-icon gl-vertical-align-middle gl-text-gray-500'), class: 'gl-mr-2', aria: { hidden: 'true' })
output << content_tag(:span, sprite_icon(issuable.work_item_type.icon_name.to_s, css_class: 'gl-icon gl-vertical-align-middle gl-text-gray-500'), class: 'gl-mr-2', aria: { hidden: 'true' })
output << content_tag(:span, s_('IssuableStatus|%{wi_type} created %{created_at} by ').html_safe % { wi_type: IntegrationsHelper.integration_issue_type(issuable.issue_type), created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2')
else
output << content_tag(:span, s_('IssuableStatus|Created %{created_at} by').html_safe % { created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2')

View File

@ -23,9 +23,9 @@ module NavHelper
if page_has_markdown? && !current_controller?('conflicts')
if cookies[:collapsed_gutter] == 'true'
["page-gutter", "#{'right-sidebar-collapsed' unless moved_sidebar_enabled}"]
["page-gutter", ('right-sidebar-collapsed' unless moved_sidebar_enabled).to_s]
else
["page-gutter", "#{'right-sidebar-expanded' unless moved_sidebar_enabled}"]
["page-gutter", ('right-sidebar-expanded' unless moved_sidebar_enabled).to_s]
end
elsif current_path?('jobs#show')
%w[page-gutter build-sidebar right-sidebar-expanded]

View File

@ -465,9 +465,9 @@ module ProjectsHelper
def project_coverage_chart_data_attributes(daily_coverage_options, ref)
{
graph_endpoint: "#{daily_coverage_options[:graph_api_path]}?#{daily_coverage_options[:base_params].to_query}",
graph_start_date: "#{daily_coverage_options[:base_params][:start_date].strftime('%b %d')}",
graph_end_date: "#{daily_coverage_options[:base_params][:end_date].strftime('%b %d')}",
graph_ref: "#{ref}",
graph_start_date: daily_coverage_options[:base_params][:start_date].strftime('%b %d'),
graph_end_date: daily_coverage_options[:base_params][:end_date].strftime('%b %d'),
graph_ref: ref.to_s,
graph_csv_path: "#{daily_coverage_options[:download_path]}?#{daily_coverage_options[:base_params].to_query}"
}
end

View File

@ -309,8 +309,8 @@ module SearchHelper
{
category: "Groups",
id: group.id,
value: "#{search_result_sanitize(group.name)}",
label: "#{search_result_sanitize(group.full_name)}",
value: search_result_sanitize(group.name),
label: search_result_sanitize(group.full_name),
url: group_path(group),
avatar_url: group.avatar_url || ''
}
@ -344,8 +344,8 @@ module SearchHelper
{
category: "Projects",
id: p.id,
value: "#{search_result_sanitize(p.name)}",
label: "#{search_result_sanitize(p.full_name)}",
value: search_result_sanitize(p.name),
label: search_result_sanitize(p.full_name),
url: project_path(p),
avatar_url: p.avatar_url || ''
}
@ -363,8 +363,8 @@ module SearchHelper
{
category: "Users",
id: user.id,
value: "#{search_result_sanitize(user.name)}",
label: "#{search_result_sanitize(user.username)}",
value: search_result_sanitize(user.name),
label: search_result_sanitize(user.username),
url: user_path(user),
avatar_url: user.avatar_url || ''
}

View File

@ -14,10 +14,10 @@ module Tooling
GITLAB_ORG_GITLAB_PROJECT_PATH = 'gitlab-org/gitlab'
def visual_review_toolbar_options
{ 'data-merge-request-id': "#{ENV['REVIEW_APPS_MERGE_REQUEST_IID']}",
'data-mr-url': "#{GITLAB_INSTANCE_URL}",
'data-project-id': "#{GITLAB_ORG_GITLAB_PROJECT_ID}",
'data-project-path': "#{GITLAB_ORG_GITLAB_PROJECT_PATH}",
{ 'data-merge-request-id': ENV['REVIEW_APPS_MERGE_REQUEST_IID'].to_s,
'data-mr-url': GITLAB_INSTANCE_URL,
'data-project-id': GITLAB_ORG_GITLAB_PROJECT_ID,
'data-project-path': GITLAB_ORG_GITLAB_PROJECT_PATH,
'data-require-auth': false,
'id': 'review-app-toolbar-script',
'src': 'https://gitlab.com/assets/webpack/visual_review_toolbar.js' }

View File

@ -366,7 +366,7 @@ module Issuable
select(issuable_columns)
.select(extra_select_columns)
.from("#{table_name}")
.from(table_name.to_s)
.joins("JOIN LATERAL(#{highest_priority}) as highest_priorities ON TRUE")
.group(group_columns)
.reorder(highest_priority_arel_with_direction.nulls_last)

View File

@ -101,7 +101,7 @@ module Integrations
next unless requires_webhook?
fields.unshift(
{ type: 'text', name: 'webhook', help: "#{webhook_help}", required: true }.freeze,
{ type: 'text', name: 'webhook', help: webhook_help, required: true }.freeze,
{ type: 'text', name: 'username', placeholder: 'GitLab-integration' }.freeze
)
end.freeze

View File

@ -112,7 +112,7 @@ module Integrations
user: user_key,
device: device,
priority: priority,
title: "#{project.full_name}",
title: project.full_name.to_s,
message: message,
url: data[:project][:web_url],
url_title: s_("PushoverService|See project %{project_full_name}") % { project_full_name: project.full_name }

View File

@ -1399,7 +1399,7 @@ class MergeRequest < ApplicationRecord
message << "Closes #{closes_issues_references.to_sentence}"
end
message << "#{description}" if include_description && description.present?
message << description if include_description && description.present?
message << "See merge request #{to_reference(full: true)}"
message.join("\n\n")

View File

@ -73,7 +73,7 @@ module JiraImport
jira_imports_for_project = project.jira_imports.by_jira_project_key(jira_project_key).size + 1
title = "jira-import::#{jira_project_key}-#{jira_imports_for_project}"
description = "Label for issues that were imported from Jira on #{import_start_time.strftime('%Y-%m-%d %H:%M:%S')}"
color = "#{::Gitlab::Color.color_for(title)}"
color = ::Gitlab::Color.color_for(title).to_s
{ title: title, description: description, color: color }
end

View File

@ -42,7 +42,7 @@ module Users
end
def log_event(user)
Gitlab::AppLogger.info(message: "User instance access request approved", user: "#{user.username}", email: "#{user.email}", approved_by: "#{current_user.username}", ip_address: "#{current_user.current_sign_in_ip}")
Gitlab::AppLogger.info(message: "User instance access request approved", user: user.username.to_s, email: user.email.to_s, approved_by: current_user.username.to_s, ip_address: current_user.current_sign_in_ip.to_s)
end
end
end

View File

@ -36,7 +36,7 @@ module Users
end
def log_event(user)
Gitlab::AppLogger.info(message: "User #{action}", user: "#{user.username}", email: "#{user.email}", "#{action}_by": "#{current_user.username}", ip_address: "#{current_user.current_sign_in_ip}")
Gitlab::AppLogger.info(message: "User #{action}", user: user.username.to_s, email: user.email.to_s, "#{action}_by": current_user.username.to_s, ip_address: current_user.current_sign_in_ip.to_s)
end
end
end

View File

@ -34,7 +34,7 @@ module Users
end
def log_event(user)
Gitlab::AppLogger.info(message: "User instance access request rejected", user: "#{user.username}", email: "#{user.email}", rejected_by: "#{current_user.username}", ip_address: "#{current_user.current_sign_in_ip}")
Gitlab::AppLogger.info(message: "User instance access request rejected", user: user.username.to_s, email: user.email.to_s, rejected_by: current_user.username.to_s, ip_address: current_user.current_sign_in_ip.to_s)
end
end
end

View File

@ -16,7 +16,7 @@ class ScheduleBackfillDraftStatusOnMergeRequestsCorrectedRegex < Gitlab::Databas
eligible_mrs = MergeRequest.where(state_id: 1)
.where(draft: false)
.where("title ~* ?", "#{CORRECTED_REGEXP_STR}")
.where("title ~* ?", CORRECTED_REGEXP_STR)
queue_background_migration_jobs_by_range_at_intervals(
eligible_mrs,

View File

@ -839,20 +839,20 @@ Supported attributes:
Use `detailed_merge_status` instead of `merge_status` to account for all potential statuses.
- The `detailed_merge_status` field may hold one of the following values:
- `blocked_status`: Merge request is blocked by another merge request.
- `broken_status`: Can not merge the source into the target branch, potential conflict.
- `checking`: currently checking for mergeability.
- `ci_must_pass`: Pipeline must succeed before merging.
- `ci_still_running`: Pipeline is still running.
- `discussions_not_resolved`: Discussions must be resolved before merging.
- `draft_status`: Merge request must not be draft before merging.
- `external_status_checks`: Status checks must pass.
- `mergeable`: branch can be merged.
- `not_approved`: Merge request must be approved before merging.
- `not_open`: merge request must be open before merging.
- `policies_denied`: There are denied policies for the merge request.
- `unchecked`: merge status has not been checked.
- The `detailed_merge_status` field can contain one of the following values related to the merge request:
- `blocked_status`: Blocked by another merge request.
- `broken_status`: Can't merge into the target branch due to a potential conflict.
- `checking`: Mergeability checks are still in progress.
- `ci_must_pass`: A CI/CD pipeline must succeed before merge.
- `ci_still_running`: A CI/CD pipeline is still running.
- `discussions_not_resolved`: All discussions must be resolved before merge.
- `draft_status`: Can't merge because the merge request is a draft.
- `external_status_checks`: All status checks must pass before merge.
- `mergeable`: The branch can merge cleanly into the target branch.
- `not_approved`: Approval is required before merge.
- `not_open`: The merge request must be open before merge.
- `policies_denied`: The merge request contains denied policies.
- `unchecked`: The merge status has not been checked.
## Get single merge request participants

View File

@ -89,7 +89,8 @@ They're responsible for defining a timestamp expression that is used in the calc
#### Implementing an `Event` class
There are a few methods that are required to be implemented, the `StageEvent` base class describes them in great detail. The most important ones are:
You must implement a few methods, as described in the `StageEvent` base class.
The most important methods are:
- `object_type`
- `timestamp_projection`

View File

@ -56,7 +56,7 @@ database with a minimal development effort.
![vsa object hierarchy example](img/object_hierarchy_example_V14_10.png)
In this example, there are two independent value streams set up for two teams that are using
In this example, two independent value streams are set up for two teams that are using
different development workflows within the `Test Group` (top-level namespace).
The first value stream uses standard timestamp-based events for defining the stages. The second
@ -102,7 +102,7 @@ High-level overview for each top-level namespace with Premium or Ultimate licens
1. `INSERT` or `UPDATE` the data into the VSA database tables.
The data loading is implemented within the [`Analytics::CycleAnalytics::DataLoaderService`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/services/analytics/cycle_analytics/data_loader_service.rb)
class. There are groups containing a lot of data, so to avoid overloading the primary database,
class. Some groups contain a lot of data, so to avoid overloading the primary database,
the service performs operations in batches and enforces strict application limits:
- Load records in batches.

View File

@ -204,7 +204,7 @@ Value stream analytics records the following times for each stage:
- **Review**: 14:00 to 19:00: 5 hrs
- **Staging**: 19:00 to 19:30: 30 minutes
There are some additional considerations for this example:
Keep in mind the following observations related to this example:
- Although this example specifies the issue number in a later commit, the process
still collects analytics data for the issue.

View File

@ -24,8 +24,7 @@ To view Contribution Analytics:
## Using Contribution Analytics
There are three main bar graphs that illustrate the number of contributions per group
member for the following:
Three bar graphs illustrate the number of contributions made by each group member:
- Push events
- Merge requests

View File

@ -223,7 +223,7 @@ Value stream analytics records the following times for each stage:
- **Review**: 14:00 to 19:00: 5 hrs
- **Staging**: 19:00 to 19:30: 30 minutes
There are some additional considerations for this example:
Keep in mind the following observations related to this example:
- This example demonstrates that it doesn't matter if your first
commit doesn't mention the issue number, you can do this later in any commit

View File

@ -12,7 +12,7 @@ module Gitlab
def self.open(user, &block)
Gitlab::Auth::Ldap::Adapter.open(user.ldap_identity.provider) do |adapter|
block.call(self.new(user, adapter))
yield(self.new(user, adapter))
end
end

View File

@ -11,7 +11,7 @@ module Gitlab
def self.open(provider, &block)
Net::LDAP.open(config(provider).adapter_options) do |ldap|
block.call(self.new(provider, ldap))
yield(self.new(provider, ldap))
end
end

View File

@ -8,9 +8,9 @@ module Gitlab
def initialize(cache, pipeline)
cache = Array.wrap(cache)
@cache = cache.map do |cache|
@cache = cache.map.with_index do |cache, index|
Gitlab::Ci::Pipeline::Seed::Build::Cache
.new(pipeline, cache)
.new(pipeline, cache, index)
end
end

View File

@ -6,7 +6,7 @@ module Gitlab
module Seed
class Build
class Cache
def initialize(pipeline, cache)
def initialize(pipeline, cache, custom_key_prefix)
@pipeline = pipeline
local_cache = cache.to_h.deep_dup
@key = local_cache.delete(:key)
@ -14,6 +14,7 @@ module Gitlab
@policy = local_cache.delete(:policy)
@untracked = local_cache.delete(:untracked)
@when = local_cache.delete(:when)
@custom_key_prefix = custom_key_prefix
raise ArgumentError, "unknown cache keys: #{local_cache.keys}" if local_cache.any?
end
@ -45,6 +46,7 @@ module Gitlab
def key_from_files
return unless @key.is_a?(Hash)
@key[:prefix] ||= @custom_key_prefix.to_s
[@key[:prefix], files_digest].select(&:present?).join('-')
end

View File

@ -157,7 +157,7 @@ module Gitlab
def self.execute(columns, mapping, &to_class)
raise ArgumentError if mapping.blank?
entries_by_class = mapping.group_by { |k, v| to_class ? to_class.call(k) : k.class }
entries_by_class = mapping.group_by { |k, v| to_class ? yield(k) : k.class }
entries_by_class.each do |model, entries|
Setter.new(model, columns, entries).update!

View File

@ -59,7 +59,7 @@ module Gitlab
raise ReadTotalTimeout, "Request timed out after #{elapsed} seconds"
end
block.call fragment if block
yield fragment if block
end
rescue HTTParty::RedirectionTooDeep
raise RedirectionTooDeep

View File

@ -40,7 +40,7 @@ module Gitlab
def self.delete_if(&block)
return unless RequestStore.active?
storage.delete_if { |k, v| block.call(k) }
storage.delete_if { |k, v| yield(k) }
end
end
end

View File

@ -8,9 +8,9 @@ module Gitlab
# negative arity means arguments are optional
if block.arity == 1 || block.arity < 0
block.call(model)
yield(model)
else
block.call
yield
end
ensure

View File

@ -76,13 +76,9 @@ namespace :dev do
namespace :copy_db do
ALLOWED_DATABASES = %w[ci].freeze
defined_copy_db_tasks = []
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
next unless ALLOWED_DATABASES.include?(name)
defined_copy_db_tasks << name
desc "Copies the #{name} database from the main database"
task name => :environment do
Rake::Task["dev:terminate_all_connections"].invoke
@ -94,16 +90,5 @@ namespace :dev do
warn "Database '#{db_config.database}' already exists"
end
end
ALLOWED_DATABASES.each do |name|
next if defined_copy_db_tasks.include?(name)
# :nocov: we cannot mock ActiveRecord::Tasks::DatabaseTasks in time
# Workaround for GDK issue, see
# https://gitlab.com/gitlab-org/gitlab-development-kit/-/issues/1464
desc "No-op task"
task name
# :nocov:
end
end
end

View File

@ -145,7 +145,7 @@ RSpec.describe 'Dashboard > User filters projects', feature_category: :projects
end
it 'filters any project' do
# Selecting the same option in the `GlListbox` does not emit `select` event
# Selecting the same option in the `GlCollapsibleListbox` does not emit `select` event
# and that is why URL update won't be triggered. Given that `Any` is a default option
# we need to explicitly switch from some other option (e.g. `Internal`) to `Any`
# to trigger the page update

View File

@ -201,7 +201,12 @@ RSpec.describe 'Projects > Settings > Repository settings' do
click_button 'Mirror repository'
end
expect(page).to have_content('Mirroring settings were successfully updated')
# TODO: The following line is skipped because a toast with
# "An error occurred while loading branch rules. Please try again."
# shows up right after which hides the below message. It is causing flakiness.
# https://gitlab.com/gitlab-org/gitlab/-/issues/383717#note_1185091998
# expect(page).to have_content('Mirroring settings were successfully updated')
expect(project.reload.remote_mirrors.first.keep_divergent_refs).to eq(true)
end
@ -217,7 +222,12 @@ RSpec.describe 'Projects > Settings > Repository settings' do
click_button 'Mirror repository'
end
expect(page).to have_content('Mirroring settings were successfully updated')
# TODO: The following line is skipped because a toast with
# "An error occurred while loading branch rules. Please try again."
# shows up right after which hides the below message. It is causing flakiness.
# https://gitlab.com/gitlab-org/gitlab/-/issues/383717#note_1185091998
# expect(page).to have_content('Mirroring settings were successfully updated')
expect(page).to have_selector('[title="Copy SSH public key"]')
end

View File

@ -1,4 +1,4 @@
import { GlListbox } from '@gitlab/ui';
import { GlCollapsibleListbox } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import BackgroundMigrationsDatabaseListbox from '~/admin/background_migrations/components/database_listbox.vue';
import { visitUrl, setUrlParams } from '~/lib/utils/url_utility';
@ -30,15 +30,15 @@ describe('BackgroundMigrationsDatabaseListbox', () => {
wrapper.destroy();
});
const findGlListbox = () => wrapper.findComponent(GlListbox);
const findGlCollapsibleListbox = () => wrapper.findComponent(GlCollapsibleListbox);
describe('template always', () => {
beforeEach(() => {
createComponent();
});
it('renders GlListbox', () => {
expect(findGlListbox().exists()).toBe(true);
it('renders GlCollapsibleListbox', () => {
expect(findGlCollapsibleListbox().exists()).toBe(true);
});
});
@ -48,7 +48,7 @@ describe('BackgroundMigrationsDatabaseListbox', () => {
});
it('selecting a listbox item fires visitUrl with the database param', () => {
findGlListbox().vm.$emit('select', MOCK_DATABASES[1].value);
findGlCollapsibleListbox().vm.$emit('select', MOCK_DATABASES[1].value);
expect(setUrlParams).toHaveBeenCalledWith({ database: MOCK_DATABASES[1].value });
expect(visitUrl).toHaveBeenCalled();

View File

@ -1,6 +1,6 @@
import { nextTick } from 'vue';
import { getAllByRole, getByTestId } from '@testing-library/dom';
import { GlListbox } from '@gitlab/ui';
import { GlCollapsibleListbox } from '@gitlab/ui';
import { createWrapper } from '@vue/test-utils';
import { initListbox, parseAttributes } from '~/listbox';
import { getFixture, setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
@ -41,7 +41,7 @@ describe('initListbox', () => {
describe('given a valid element', () => {
let onChangeSpy;
const listbox = () => createWrapper(instance).findComponent(GlListbox);
const listbox = () => createWrapper(instance).findComponent(GlCollapsibleListbox);
const findToggleButton = () => getByTestId(document.body, 'base-dropdown-toggle');
const findSelectedItems = () => getAllByRole(document.body, 'option', { selected: true });

View File

@ -1,6 +1,6 @@
import Vue, { nextTick } from 'vue';
import VueApollo from 'vue-apollo';
import { GlListbox } from '@gitlab/ui';
import { GlCollapsibleListbox } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import searchUsersQuery from '~/graphql_shared/queries/users_search_all.query.graphql';
@ -59,7 +59,7 @@ describe('fogbugz user select component', () => {
const id = 8;
wrapper.findComponent(GlListbox).vm.$emit('select', `gid://gitlab/User/${id}`);
wrapper.findComponent(GlCollapsibleListbox).vm.$emit('select', `gid://gitlab/User/${id}`);
await nextTick();
expect(wrapper.get('input').attributes('value')).toBe(id.toString());
@ -69,7 +69,7 @@ describe('fogbugz user select component', () => {
createComponent();
jest.runOnlyPendingTimers();
wrapper.findComponent(GlListbox).vm.$emit('search', 'test');
wrapper.findComponent(GlCollapsibleListbox).vm.$emit('search', 'test');
await nextTick();
jest.runOnlyPendingTimers();

View File

@ -1,5 +1,5 @@
import { nextTick } from 'vue';
import { GlListbox } from '@gitlab/ui';
import { GlCollapsibleListbox } from '@gitlab/ui';
import MockAdapter from 'axios-mock-adapter';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import axios from '~/lib/utils/axios_utils';
@ -31,7 +31,7 @@ describe('GroupSelect', () => {
const inputId = 'inputId';
// Finders
const findListbox = () => wrapper.findComponent(GlListbox);
const findListbox = () => wrapper.findComponent(GlCollapsibleListbox);
const findInput = () => wrapper.findByTestId('input');
// Helpers

View File

@ -69,7 +69,7 @@ RSpec.describe Banzai::Filter::RepositoryLinkFilter do
expect { filter(raw_doc) }.to change { Gitlab::GitalyClient.get_request_count }.by(2)
end
shared_examples :preserve_unchanged do
shared_examples 'preserve unchanged' do
it 'does not modify any relative URL in anchor' do
doc = filter(link('README.md'))
expect(doc.at_css('a')['href']).to eq 'README.md'
@ -96,25 +96,25 @@ RSpec.describe Banzai::Filter::RepositoryLinkFilter do
context 'with a wiki' do
let(:wiki) { double('ProjectWiki') }
include_examples :preserve_unchanged
include_examples 'preserve unchanged'
end
context 'without a repository' do
let(:project) { create(:project) }
include_examples :preserve_unchanged
include_examples 'preserve unchanged'
end
context 'with an empty repository' do
let(:project) { create(:project_empty_repo) }
include_examples :preserve_unchanged
include_examples 'preserve unchanged'
end
context 'without project repository access' do
let(:project) { create(:project, :repository, repository_access_level: ProjectFeature::PRIVATE) }
include_examples :preserve_unchanged
include_examples 'preserve unchanged'
end
it 'does not raise an exception on invalid URIs' do
@ -147,7 +147,7 @@ RSpec.describe Banzai::Filter::RepositoryLinkFilter do
.to eq "/#{project_path}/-/blob/#{ref}/non/existent.file"
end
shared_examples :valid_repository do
shared_examples 'valid repository' do
it 'handles Gitaly unavailable exceptions gracefully' do
allow_next_instance_of(Gitlab::GitalyClient::BlobService) do |blob_service|
allow(blob_service).to receive(:get_blob_types).and_raise(GRPC::Unavailable)
@ -364,13 +364,13 @@ RSpec.describe Banzai::Filter::RepositoryLinkFilter do
end
context 'with a valid commit' do
include_examples :valid_repository
include_examples 'valid repository'
end
context 'with a valid ref' do
# force filter to use ref instead of commit
let(:commit) { nil }
include_examples :valid_repository
include_examples 'valid repository'
end
end

View File

@ -697,7 +697,7 @@ module Gitlab
end
end
shared_examples :invalid_include do
shared_examples 'invalid include' do
let(:include_path) { 'dk.png' }
before do
@ -716,7 +716,7 @@ module Gitlab
context 'with path to a binary file' do
let(:blob) { fake_blob(path: 'dk.png', binary: true) }
include_examples :invalid_include
include_examples 'invalid include'
end
context 'with path to file in external storage' do
@ -727,7 +727,7 @@ module Gitlab
project.update_attribute(:lfs_enabled, true)
end
include_examples :invalid_include
include_examples 'invalid include'
end
context 'with path to a textual file' do
@ -737,7 +737,7 @@ module Gitlab
create_file(file_path, "Content from #{include_path}")
end
shared_examples :valid_include do
shared_examples 'valid include' do
[
['/doc/sample.adoc', 'doc/sample.adoc', 'absolute path'],
['sample.adoc', 'doc/api/sample.adoc', 'relative path'],
@ -760,24 +760,24 @@ module Gitlab
context 'when requested path is a file in the repo' do
let(:requested_path) { 'doc/api/README.adoc' }
include_examples :valid_include
include_examples 'valid include'
context 'without a commit (only ref)' do
let(:commit) { nil }
include_examples :valid_include
include_examples 'valid include'
end
end
context 'when requested path is a directory in the repo' do
let(:requested_path) { 'doc/api/' }
include_examples :valid_include
include_examples 'valid include'
context 'without a commit (only ref)' do
let(:commit) { nil }
include_examples :valid_include
include_examples 'valid include'
end
end
end

View File

@ -14,8 +14,8 @@ RSpec.describe Gitlab::Ci::Build::Cache do
cache = described_class.new(cache_config, pipeline)
expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, { key: 'key-a' })
expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, { key: 'key-b' })
expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, { key: 'key-a' }, 0)
expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, { key: 'key-b' }, 1)
expect(cache.instance_variable_get(:@cache)).to eq([cache_seed_a, cache_seed_b])
end
end
@ -29,7 +29,7 @@ RSpec.describe Gitlab::Ci::Build::Cache do
cache = described_class.new(cache_config, pipeline)
expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, cache_config)
expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, cache_config, 0)
expect(cache.instance_variable_get(:@cache)).to eq([cache_seed])
end
end

View File

@ -6,8 +6,9 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build::Cache do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:head_sha) { project.repository.head_commit.id }
let_it_be(:pipeline) { create(:ci_pipeline, project: project, sha: head_sha) }
let(:index) { 1 }
let(:processor) { described_class.new(pipeline, config) }
let(:processor) { described_class.new(pipeline, config, index) }
describe '#attributes' do
subject { processor.attributes }
@ -40,10 +41,12 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build::Cache do
{ key: { files: files } }
end
it 'uses default key' do
expected = { key: 'default' }
context 'without a prefix' do
it 'uses default key with an index as a prefix' do
expected = { key: '1-default' }
is_expected.to include(expected)
is_expected.to include(expected)
end
end
end
@ -57,13 +60,15 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build::Cache do
}
end
it 'builds a string key' do
expected = {
key: '703ecc8fef1635427a1f86a8a1a308831c122392',
paths: ['vendor/ruby']
}
context 'without a prefix' do
it 'builds a string key with an index as a prefix' do
expected = {
key: '1-703ecc8fef1635427a1f86a8a1a308831c122392',
paths: ['vendor/ruby']
}
is_expected.to include(expected)
is_expected.to include(expected)
end
end
end
@ -107,10 +112,12 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build::Cache do
}
end
it 'builds a string key' do
expected = { key: '74bf43fb1090f161bdd4e265802775dbda2f03d1' }
context 'without a prefix' do
it 'builds a string key with an index as a prefix' do
expected = { key: '1-74bf43fb1090f161bdd4e265802775dbda2f03d1' }
is_expected.to include(expected)
is_expected.to include(expected)
end
end
end

View File

@ -152,7 +152,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do
it 'includes cache options' do
cache_options = {
options: {
cache: [a_hash_including(key: 'f155568ad0933d8358f66b846133614f76dd0ca4')]
cache: [a_hash_including(key: '0-f155568ad0933d8358f66b846133614f76dd0ca4')]
}
}

View File

@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Email::Handler::CreateIssueHandler do
include_context :email_shared_context
include_context 'email shared context'
let!(:user) do
create(
:user,
@ -16,7 +16,7 @@ RSpec.describe Gitlab::Email::Handler::CreateIssueHandler do
let(:namespace) { create(:namespace, path: 'gitlabhq') }
let(:email_raw) { email_fixture('emails/valid_new_issue.eml') }
it_behaves_like :reply_processing_shared_examples
it_behaves_like 'reply processing shared examples'
before do
stub_incoming_email_setting(enabled: true, address: "incoming+%{key}@appmail.adventuretime.ooo")

View File

@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Email::Handler::CreateMergeRequestHandler do
include_context :email_shared_context
include_context 'email shared context'
let!(:user) do
create(
:user,
@ -16,7 +16,7 @@ RSpec.describe Gitlab::Email::Handler::CreateMergeRequestHandler do
let(:namespace) { create(:namespace, path: 'gitlabhq') }
let(:email_raw) { email_fixture('emails/valid_new_merge_request.eml') }
it_behaves_like :reply_processing_shared_examples
it_behaves_like 'reply processing shared examples'
before do
stub_incoming_email_setting(enabled: true, address: "incoming+%{key}@appmail.adventuretime.ooo")

View File

@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Email::Handler::CreateNoteHandler do
include_context :email_shared_context
include_context 'email shared context'
let_it_be(:user) { create(:user, email: 'jake@adventuretime.ooo') }
let_it_be(:project) { create(:project, :public, :repository) }
@ -15,9 +15,9 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteHandler do
SentNotification.record_note(note, user.id, mail_key)
end
it_behaves_like :reply_processing_shared_examples
it_behaves_like 'reply processing shared examples'
it_behaves_like :note_handler_shared_examples do
it_behaves_like 'note handler shared examples' do
let(:recipient) { sent_notification.recipient }
let(:update_commands_only) { fixture_file('emails/update_commands_only_reply.eml') }
@ -92,7 +92,7 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteHandler do
issue.update_attribute(:confidential, true)
end
it_behaves_like :checks_permissions_on_noteable_examples
it_behaves_like 'checks permissions on noteable examples'
end
shared_examples 'a reply to existing comment' do

View File

@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Email::Handler::CreateNoteOnIssuableHandler do
include_context :email_shared_context
include_context 'email shared context'
let_it_be(:user) { create(:user, email: 'jake@adventuretime.ooo', incoming_email_token: 'auth_token') }
let_it_be(:namespace) { create(:namespace, path: 'gitlabhq') }
@ -17,9 +17,9 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteOnIssuableHandler do
stub_config_setting(host: 'localhost')
end
it_behaves_like :reply_processing_shared_examples
it_behaves_like 'reply processing shared examples'
it_behaves_like :note_handler_shared_examples, true do
it_behaves_like 'note handler shared examples', true do
let_it_be(:recipient) { user }
let(:update_commands_only) { email_reply_fixture('emails/update_commands_only.eml') }
@ -42,7 +42,7 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteOnIssuableHandler do
noteable.update_attribute(:confidential, true)
end
it_behaves_like :checks_permissions_on_noteable_examples
it_behaves_like 'checks permissions on noteable examples'
end
def email_fixture(path)

View File

@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler do
include_context :email_shared_context
include_context 'email shared context'
before do
stub_incoming_email_setting(enabled: true, address: "incoming+%{key}@appmail.adventuretime.ooo")

View File

@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Email::Handler::UnsubscribeHandler do
include_context :email_shared_context
include_context 'email shared context'
before do
stub_incoming_email_setting(enabled: true, address: 'reply+%{key}@appmail.adventuretime.ooo')

View File

@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Email::Receiver do
include_context :email_shared_context
include_context 'email shared context'
let_it_be(:project) { create(:project) }
let(:metric_transaction) { instance_double(Gitlab::Metrics::WebTransaction) }

View File

@ -8,7 +8,7 @@ RSpec.describe Gitlab::Git::Tree do
let(:project) { create(:project, :repository) }
let(:repository) { project.repository.raw }
shared_examples :repo do
shared_examples 'repo' do
subject(:tree) { Gitlab::Git::Tree.where(repository, sha, path, recursive, skip_flat_paths, pagination_params) }
let(:sha) { SeedRepo::Commit::ID }
@ -151,7 +151,7 @@ RSpec.describe Gitlab::Git::Tree do
end
describe '.where with Gitaly enabled' do
it_behaves_like :repo do
it_behaves_like 'repo' do
context 'with pagination parameters' do
let(:pagination_params) { { limit: 3, page_token: nil } }
@ -172,7 +172,7 @@ RSpec.describe Gitlab::Git::Tree do
described_class.where(repository, SeedRepo::Commit::ID, 'files', false, false)
end
it_behaves_like :repo do
it_behaves_like 'repo' do
describe 'Pagination' do
context 'with restrictive limit' do
let(:pagination_params) { { limit: 3, page_token: nil } }

View File

@ -232,7 +232,7 @@ RSpec.describe DesignManagement::Version do
context 'there is a single design' do
let_it_be(:design) { create(:design) }
shared_examples :a_correctly_categorised_design do |kind, category|
shared_examples 'a correctly categorised design' do |kind, category|
let_it_be(:version) { create(:design_version, kind => [design]) }
it 'returns a hash with a single key and the single design in that bucket' do
@ -240,9 +240,9 @@ RSpec.describe DesignManagement::Version do
end
end
it_behaves_like :a_correctly_categorised_design, :created_designs, 'creation'
it_behaves_like :a_correctly_categorised_design, :modified_designs, 'modification'
it_behaves_like :a_correctly_categorised_design, :deleted_designs, 'deletion'
it_behaves_like 'a correctly categorised design', :created_designs, 'creation'
it_behaves_like 'a correctly categorised design', :modified_designs, 'modification'
it_behaves_like 'a correctly categorised design', :deleted_designs, 'deletion'
end
context 'there are a bunch of different designs in a variety of states' do

View File

@ -37,7 +37,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do
end
end
shared_context :drone_ci_integration do
shared_context 'drone ci integration' do
subject(:drone) do
described_class.new(
project: project,
@ -116,7 +116,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do
end
it_behaves_like Integrations::HasWebHook do
include_context :drone_ci_integration
include_context 'drone ci integration'
let(:integration) { drone }
let(:hook_url) { "#{drone_url}/hook?owner=#{project.namespace.full_path}&name=#{project.path}&access_token={token}" }
@ -130,14 +130,14 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do
end
describe "integration page/path methods" do
include_context :drone_ci_integration
include_context 'drone ci integration'
it { expect(drone.build_page(sha, branch)).to eq(build_page) }
it { expect(drone.commit_status_path(sha, branch)).to eq(commit_status_path) }
end
describe '#commit_status' do
include_context :drone_ci_integration
include_context 'drone ci integration'
it 'returns the contents of the reactive cache' do
stub_reactive_cache(drone, { commit_status: 'foo' }, 'sha', 'ref')
@ -147,7 +147,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do
end
describe '#calculate_reactive_cache' do
include_context :drone_ci_integration
include_context 'drone ci integration'
describe '#commit_status' do
subject { drone.calculate_reactive_cache(sha, branch)[:commit_status] }
@ -193,7 +193,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do
end
describe "execute" do
include_context :drone_ci_integration
include_context 'drone ci integration'
let(:user) { build(:user, username: 'username') }
let(:push_sample_data) do

View File

@ -4436,7 +4436,7 @@ RSpec.describe User do
shared_context '#ci_owned_runners' do
let(:user) { create(:user) }
shared_examples :nested_groups_owner do
shared_examples 'nested groups owner' do
context 'when the user is the owner of a multi-level group' do
before do
set_permissions_for_users
@ -4453,7 +4453,7 @@ RSpec.describe User do
end
end
shared_examples :group_owner do
shared_examples 'group owner' do
context 'when the user is the owner of a one level group' do
before do
group.add_owner(user)
@ -4469,7 +4469,7 @@ RSpec.describe User do
end
end
shared_examples :project_owner do
shared_examples 'project owner' do
context 'when the user is the owner of a project' do
it 'loads the runner belonging to the project' do
expect(user.ci_owned_runners).to contain_exactly(runner)
@ -4481,7 +4481,7 @@ RSpec.describe User do
end
end
shared_examples :project_member do
shared_examples 'project member' do
context 'when the user is a maintainer' do
before do
add_user(:maintainer)
@ -4539,7 +4539,7 @@ RSpec.describe User do
end
end
shared_examples :group_member do
shared_examples 'group member' do
context 'when the user is a maintainer' do
before do
add_user(:maintainer)
@ -4612,7 +4612,7 @@ RSpec.describe User do
let!(:project) { create(:project, namespace: namespace) }
let!(:runner) { create(:ci_runner, :project, projects: [project]) }
it_behaves_like :project_owner
it_behaves_like 'project owner'
end
context 'with group runner in a non owned group' do
@ -4623,14 +4623,14 @@ RSpec.describe User do
group.add_member(user, access)
end
it_behaves_like :group_member
it_behaves_like 'group member'
end
context 'with group runner in an owned group' do
let!(:group) { create(:group) }
let!(:group_runner) { create(:ci_runner, :group, groups: [group]) }
it_behaves_like :group_owner
it_behaves_like 'group owner'
end
context 'with group runner in an owned group and group runner in a different owner subgroup' do
@ -4645,7 +4645,7 @@ RSpec.describe User do
subgroup.add_owner(another_user)
end
it_behaves_like :nested_groups_owner
it_behaves_like 'nested groups owner'
end
context 'with personal project runner in an an owned group and a group runner in that same group' do
@ -4658,7 +4658,7 @@ RSpec.describe User do
group.add_owner(user)
end
it_behaves_like :nested_groups_owner
it_behaves_like 'nested groups owner'
end
context 'with personal project runner in an owned group and a group runner in a subgroup' do
@ -4672,7 +4672,7 @@ RSpec.describe User do
group.add_owner(user)
end
it_behaves_like :nested_groups_owner
it_behaves_like 'nested groups owner'
end
context 'with personal project runner in an owned group in an owned namespace and a group runner in that group' do
@ -4686,7 +4686,7 @@ RSpec.describe User do
group.add_owner(user)
end
it_behaves_like :nested_groups_owner
it_behaves_like 'nested groups owner'
end
context 'with personal project runner in an owned namespace, an owned group, a subgroup and a group runner in that subgroup' do
@ -4701,7 +4701,7 @@ RSpec.describe User do
group.add_owner(user)
end
it_behaves_like :nested_groups_owner
it_behaves_like 'nested groups owner'
end
context 'with a project runner that belong to projects that belong to a not owned group' do
@ -4713,7 +4713,7 @@ RSpec.describe User do
project.add_member(user, access)
end
it_behaves_like :project_member
it_behaves_like 'project member'
end
context 'with project runners that belong to projects that do not belong to any group' do
@ -4736,7 +4736,7 @@ RSpec.describe User do
group.add_member(another_user, :owner)
end
it_behaves_like :group_member
it_behaves_like 'group member'
end
end

View File

@ -67,7 +67,7 @@ RSpec.describe 'Query.project(fullPath).issue(iid).designCollection.version(sha)
query_graphql_field(:design_at_version, dav_params, 'id filename')
end
shared_examples :finds_dav do
shared_examples 'finds dav' do
it 'finds all the designs as of the given version' do
post_query
@ -88,19 +88,19 @@ RSpec.describe 'Query.project(fullPath).issue(iid).designCollection.version(sha)
context 'by ID' do
let(:dav_params) { { id: global_id_of(design_at_version) } }
include_examples :finds_dav
include_examples 'finds dav'
end
context 'by filename' do
let(:dav_params) { { filename: design.filename } }
include_examples :finds_dav
include_examples 'finds dav'
end
context 'by design_id' do
let(:dav_params) { { design_id: global_id_of(design) } }
include_examples :finds_dav
include_examples 'finds dav'
end
end

View File

@ -6,7 +6,7 @@ require_relative '../../../../rubocop/cop/performance/readlines_each'
RSpec.describe RuboCop::Cop::Performance::ReadlinesEach do
let(:message) { 'Avoid `IO.readlines.each`, since it reads contents into memory in full. Use `IO.each_line` or `IO.each` instead.' }
shared_examples_for(:class_read) do |klass|
shared_examples_for('class read') do |klass|
context "and it is called as a class method on #{klass}" do
it 'flags it as an offense' do
leading_readline = "#{klass}.readlines(file_path)."
@ -29,7 +29,7 @@ RSpec.describe RuboCop::Cop::Performance::ReadlinesEach do
context 'when reading all lines using IO.readlines.each' do
%w(IO File).each do |klass|
it_behaves_like(:class_read, klass)
it_behaves_like('class read', klass)
end
context 'and it is called as an instance method on a return value' do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
RSpec.shared_context :email_shared_context do
RSpec.shared_context 'email shared context' do
let(:mail_key) { '59d8df8370b7e95c5a49fbf86aeb2c93' }
let(:receiver) { Gitlab::Email::Receiver.new(email_raw) }
let(:markdown) { '![image](uploads/image.png)' }
@ -27,7 +27,7 @@ def service_desk_fixture(path, slug: nil, key: 'mykey')
fixture_file(path).gsub('project_slug', slug).gsub('project_key', key)
end
RSpec.shared_examples :reply_processing_shared_examples do
RSpec.shared_examples 'reply processing shared examples' do
context 'when the user could not be found' do
before do
user.destroy!
@ -49,7 +49,7 @@ RSpec.shared_examples :reply_processing_shared_examples do
end
end
RSpec.shared_examples :checks_permissions_on_noteable_examples do
RSpec.shared_examples 'checks permissions on noteable examples' do
context 'when user has access' do
before do
project.add_reporter(user)
@ -67,7 +67,7 @@ RSpec.shared_examples :checks_permissions_on_noteable_examples do
end
end
RSpec.shared_examples :note_handler_shared_examples do |forwardable|
RSpec.shared_examples 'note handler shared examples' do |forwardable|
context 'when the noteable could not be found' do
before do
noteable.destroy!
@ -157,7 +157,7 @@ RSpec.shared_examples :note_handler_shared_examples do |forwardable|
noteable.update_attribute(:discussion_locked, true)
end
it_behaves_like :checks_permissions_on_noteable_examples
it_behaves_like 'checks permissions on noteable examples'
end
context 'when everything is fine' do