Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
bca3fb69e1
commit
3867f47265
28 changed files with 209 additions and 70 deletions
|
@ -38,6 +38,8 @@ Use the built-in continuous integration in GitLab.
|
|||
|
||||
- [ ] [Get started with GitLab CI/CD](<%= redirect("https://docs.gitlab.com/ee/ci/quick_start/index.html") %>)
|
||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](<%= redirect("https://docs.gitlab.com/ee/user/application_security/sast/") %>)
|
||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](<%= redirect("https://docs.gitlab.com/ee/topics/autodevops/requirements.html") %>)
|
||||
- [ ] [Use pull-based deployments for improved Kubernetes management](<%= redirect("https://docs.gitlab.com/ee/user/clusters/agent/") %>)
|
||||
|
||||
***
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ module Clusters
|
|||
project_id: clusterable.id
|
||||
}
|
||||
|
||||
model.sanitize_sql_array([Arel.sql(order), values])
|
||||
Arel.sql(model.sanitize_sql_array([Arel.sql(order), values]))
|
||||
end
|
||||
|
||||
def group_clusters_base_query
|
||||
|
|
|
@ -33,7 +33,7 @@ module Suggestions
|
|||
.update_all(commit_id: result[:result], applied: true)
|
||||
|
||||
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter
|
||||
.track_apply_suggestion_action(user: current_user)
|
||||
.track_apply_suggestion_action(user: current_user, suggestions: suggestion_set.suggestions)
|
||||
end
|
||||
|
||||
def author
|
||||
|
|
|
@ -28,7 +28,7 @@ module Suggestions
|
|||
Gitlab::Database.main.bulk_insert('suggestions', rows) # rubocop:disable Gitlab/BulkInsert
|
||||
end
|
||||
|
||||
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_add_suggestion_action(user: @note.author)
|
||||
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_add_suggestion_action(note: @note)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,11 +10,9 @@ module WikiPages
|
|||
end
|
||||
|
||||
def execute(slug, page, action, event_fingerprint)
|
||||
event = Event.transaction do
|
||||
wiki_page_meta = WikiPage::Meta.find_or_create(slug, page)
|
||||
wiki_page_meta = WikiPage::Meta.find_or_create(slug, page)
|
||||
|
||||
::EventCreateService.new.wiki_event(wiki_page_meta, author, action, event_fingerprint)
|
||||
end
|
||||
event = ::EventCreateService.new.wiki_event(wiki_page_meta, author, action, event_fingerprint)
|
||||
|
||||
ServiceResponse.success(payload: { event: event })
|
||||
rescue ::EventCreateService::IllegalActionError, ::ActiveRecord::ActiveRecordError => e
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
key_path: redis_hll_counters.code_review.i_code_review_total_suggestions_added_monthly
|
||||
name: "count_notes_with_suggestions_monthly"
|
||||
description: Total number of monthly suggestions
|
||||
product_section: dev
|
||||
product_stage: create
|
||||
product_group: group::code review
|
||||
product_category: code_review
|
||||
value_type: number
|
||||
status: implemented
|
||||
milestone: "14.3"
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67525
|
||||
time_frame: 28d
|
||||
data_source: redis_hll
|
||||
instrumentation_class: RedisHLLMetric
|
||||
options:
|
||||
events:
|
||||
- i_code_review_total_suggestions_added
|
||||
data_category: Optional
|
||||
performance_indicator_type: []
|
||||
distribution:
|
||||
- ce
|
||||
- ee
|
||||
tier:
|
||||
- free
|
||||
- premium
|
||||
- ultimate
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
key_path: redis_hll_counters.code_review.i_code_review_total_suggestions_applied_monthly
|
||||
name: "count_notes_with_applied_suggestions_monthly"
|
||||
description: Total number of monthly suggestions applied
|
||||
product_section: dev
|
||||
product_stage: create
|
||||
product_group: group::code review
|
||||
product_category: code_review
|
||||
value_type: number
|
||||
status: implemented
|
||||
milestone: "14.3"
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67525
|
||||
time_frame: 28d
|
||||
data_source: redis_hll
|
||||
instrumentation_class: RedisHLLMetric
|
||||
options:
|
||||
events:
|
||||
- i_code_review_total_suggestions_applied
|
||||
data_category: Optional
|
||||
performance_indicator_type: []
|
||||
distribution:
|
||||
- ce
|
||||
- ee
|
||||
tier:
|
||||
- free
|
||||
- premium
|
||||
- ultimate
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
key_path: redis_hll_counters.code_review.i_code_review_total_suggestions_added_weekly
|
||||
name: "count_notes_with_suggestions_weekly"
|
||||
description: Total number of weekly suggestions
|
||||
product_section: dev
|
||||
product_stage: create
|
||||
product_group: group::code review
|
||||
product_category: code_review
|
||||
value_type: number
|
||||
status: implemented
|
||||
milestone: "14.3"
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67525
|
||||
time_frame: 7d
|
||||
data_source: redis_hll
|
||||
instrumentation_class: RedisHLLMetric
|
||||
options:
|
||||
events:
|
||||
- i_code_review_total_suggestions_added
|
||||
data_category: Optional
|
||||
performance_indicator_type: []
|
||||
distribution:
|
||||
- ce
|
||||
- ee
|
||||
tier:
|
||||
- free
|
||||
- premium
|
||||
- ultimate
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
key_path: redis_hll_counters.code_review.i_code_review_total_suggestions_applied_weekly
|
||||
name: "count_notes_with_applied_suggestions_weekly"
|
||||
description: Total number of weekly suggestions applied
|
||||
product_section: dev
|
||||
product_stage: create
|
||||
product_group: group::code review
|
||||
product_category: code_review
|
||||
value_type: number
|
||||
status: implemented
|
||||
milestone: "14.3"
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67525
|
||||
time_frame: 7d
|
||||
data_source: redis_hll
|
||||
instrumentation_class: RedisHLLMetric
|
||||
options:
|
||||
events:
|
||||
- i_code_review_total_suggestions_applied
|
||||
data_category: Optional
|
||||
performance_indicator_type: []
|
||||
distribution:
|
||||
- ce
|
||||
- ee
|
||||
tier:
|
||||
- free
|
||||
- premium
|
||||
- ultimate
|
|
@ -73,14 +73,13 @@ earlier version, you must explicitly enable it.
|
|||
- `auto_link_ldap_user` can be used if you have [LDAP / ActiveDirectory](../administration/auth/ldap/index.md)
|
||||
integration enabled. It defaults to `false`. When enabled, users automatically
|
||||
created through an OmniAuth provider have their LDAP identity created in GitLab as well.
|
||||
- `block_auto_created_users` defaults to `true`. If `true` auto created users will
|
||||
be blocked by default and must be unblocked by an administrator before
|
||||
they are able to sign in.
|
||||
- `block_auto_created_users` defaults to `true`. If `true`, auto created users will
|
||||
be blocked pending approval by an administrator before they are able to sign in.
|
||||
|
||||
NOTE:
|
||||
If you set `block_auto_created_users` to `false`, make sure to only
|
||||
define providers under `allow_single_sign_on` that you are able to control, like
|
||||
SAML, Shibboleth, Crowd, or Google. Otherwise, set it to `false`, or any user on
|
||||
SAML, Shibboleth, Crowd, or Google. Otherwise, set it to `true`, or any user on
|
||||
the Internet can successfully sign in to your GitLab without
|
||||
administrative approval.
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ test your application.
|
|||
|
||||
If you want to build, test, and deploy your app:
|
||||
|
||||
1. See the [requirements for deployment](requirements.md).
|
||||
1. View the [requirements for deployment](requirements.md).
|
||||
1. [Enable Auto DevOps](#enable-or-disable-auto-devops).
|
||||
1. Follow the [quick start guide](#quick-start).
|
||||
|
||||
|
@ -153,16 +153,18 @@ precedence over the Auto DevOps pipeline.
|
|||
|
||||
To enable Auto DevOps for a project:
|
||||
|
||||
1. Go to your project's **Settings > CI/CD > Auto DevOps**.
|
||||
1. Select the **Default to Auto DevOps pipeline**.
|
||||
1. (Recommended) Add the [base domain](requirements.md#auto-devops-base-domain).
|
||||
1. (Recommended) Choose the [deployment strategy](requirements.md#auto-devops-deployment-strategy).
|
||||
1. On the top bar, select **Menu > Projects** and find your project.
|
||||
1. On the left sidebar, select **Settings > CI/CD**.
|
||||
1. Expand **Auto DevOps**.
|
||||
1. Select the **Default to Auto DevOps pipeline** checkbox.
|
||||
1. Optional but recommended. Add the [base domain](requirements.md#auto-devops-base-domain).
|
||||
1. Optional but recommended. Choose the [deployment strategy](requirements.md#auto-devops-deployment-strategy).
|
||||
1. Select **Save changes**.
|
||||
|
||||
GitLab triggers the Auto DevOps pipeline on the default branch.
|
||||
|
||||
To disable it, follow the same process and deselect **Default to Auto
|
||||
DevOps pipeline**.
|
||||
To disable it, follow the same process and clear the
|
||||
**Default to Auto DevOps pipeline** checkbox.
|
||||
|
||||
#### At the group level
|
||||
|
||||
|
@ -180,20 +182,22 @@ at the group level.
|
|||
|
||||
To enable Auto DevOps for a group:
|
||||
|
||||
1. Go to your group's **Settings > CI/CD > Auto DevOps**.
|
||||
1. Select **Default to Auto DevOps pipeline**.
|
||||
1. On the top bar, select **Menu > Groups** and find your group.
|
||||
1. On the left sidebar, select **Settings > CI/CD**.
|
||||
1. Expand **Auto DevOps**.
|
||||
1. Select the **Default to Auto DevOps pipeline** checkbox.
|
||||
1. Select **Save changes**.
|
||||
|
||||
To disable Auto DevOps on the group level, follow the same process and
|
||||
clear the **Default to Auto DevOps pipeline** checkbox.
|
||||
|
||||
After enabling Auto DevOps at the group level, you can trigger the
|
||||
Auto DevOps pipeline for any project that belongs to that group. To do so:
|
||||
|
||||
1. Go to the project's homepage.
|
||||
1. On the top bar, select **Menu > Projects** and find your project.
|
||||
1. Make sure the project doesn't contain a `.gitlab-ci.yml` file.
|
||||
1. From the project's sidebar, go to **CI/CD > Pipelines**.
|
||||
1. Select **Run pipeline** to trigger the Auto DevOps pipeline.
|
||||
|
||||
To disable Auto DevOps on the group level, follow the same process and
|
||||
deselect **Default to Auto DevOps pipeline**.
|
||||
1. On the left sidebar, select **CI/CD > Pipelines**.
|
||||
1. To trigger the Auto DevOps pipeline, select **Run pipeline**.
|
||||
|
||||
#### At the instance level **(FREE SELF)**
|
||||
|
||||
|
@ -210,10 +214,11 @@ can still enable Auto DevOps at the group and project levels.
|
|||
|
||||
To enable Auto DevOps for your instance:
|
||||
|
||||
1. From the top bar, select **Menu >** **{admin}** **Admin**.
|
||||
1. Go to **Settings > CI/CD > Continuous Integration and Deployment**.
|
||||
1. Select **Default to Auto DevOps pipeline**.
|
||||
1. (Optional) Add the Auto DevOps [base domain](requirements.md#auto-devops-base-domain).
|
||||
1. On the top bar, select **Menu >** **{admin}** **Admin**.
|
||||
1. On the left sidebar, select **Settings > CI/CD**.
|
||||
1. Expand **Auto DevOps**.
|
||||
1. Select the **Default to Auto DevOps pipeline** checkbox.
|
||||
1. Optional. Add the Auto DevOps [base domain](requirements.md#auto-devops-base-domain).
|
||||
1. Select **Save changes**.
|
||||
|
||||
When enabled, it attempts to run Auto DevOps pipelines in every project. If the
|
||||
|
@ -224,7 +229,7 @@ If a [CI/CD configuration file](../../ci/yaml/index.md) is present,
|
|||
it remains unchanged and Auto DevOps doesn't affect it.
|
||||
|
||||
To disable Auto DevOps in the instance level, follow the same process
|
||||
and deselect the **Default to Auto DevOps pipeline** checkbox.
|
||||
and clear the **Default to Auto DevOps pipeline** checkbox.
|
||||
|
||||
### Quick start
|
||||
|
||||
|
|
|
@ -13,11 +13,12 @@ users.
|
|||
## Users pending approval
|
||||
|
||||
A user in _pending approval_ state requires action by an administrator. A user sign up can be in a
|
||||
pending approval state because an administrator has enabled either, or both, of the following
|
||||
options:
|
||||
pending approval state because an administrator has enabled any of the following options:
|
||||
|
||||
- [Require admin approval for new sign-ups](settings/sign_up_restrictions.md#require-administrator-approval-for-new-sign-ups) setting.
|
||||
- [User cap](settings/sign_up_restrictions.md#user-cap).
|
||||
- [Block auto-created users (OmniAuth)](../../integration/omniauth.md#initial-omniauth-configuration)
|
||||
- [Block auto-created users (LDAP)](../../administration/auth/ldap/index.md#basic-configuration-settings)
|
||||
|
||||
When a user registers for an account while this setting is enabled:
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ module Gitlab
|
|||
|
||||
Users::UpdateService.new(gl_user, user: gl_user).execute!
|
||||
|
||||
gl_user.block if block_after_save
|
||||
gl_user.block_pending_approval if block_after_save
|
||||
|
||||
log.info "(#{provider}) saving user #{auth_hash.email} from login with admin => #{gl_user.admin}, extern_uid => #{auth_hash.uid}"
|
||||
gl_user
|
||||
|
|
|
@ -88,11 +88,15 @@ module Gitlab
|
|||
end
|
||||
|
||||
def build_attributes
|
||||
@attributes_finder.included_attributes.each(&method(:add_permitted_attributes))
|
||||
@attributes_finder.included_attributes.each do |model_name, attributes|
|
||||
add_permitted_attributes(model_name, attributes)
|
||||
end
|
||||
end
|
||||
|
||||
def build_methods
|
||||
@attributes_finder.methods.each(&method(:add_permitted_attributes))
|
||||
@attributes_finder.methods.each do |model_name, attributes|
|
||||
add_permitted_attributes(model_name, attributes)
|
||||
end
|
||||
end
|
||||
|
||||
def add_permitted_attributes(model_name, attributes)
|
||||
|
|
|
@ -61,7 +61,9 @@ module Gitlab
|
|||
# the configuration yaml file too.
|
||||
# Finally, it updates each attribute in the newly imported project/group.
|
||||
def create_relations!
|
||||
relations.each(&method(:process_relation!))
|
||||
relations.each do |relation_key, relation_definition|
|
||||
process_relation!(relation_key, relation_definition)
|
||||
end
|
||||
end
|
||||
|
||||
def process_relation!(relation_key, relation_definition)
|
||||
|
|
|
@ -6,7 +6,8 @@ module Gitlab
|
|||
original_record_timestamps = model.record_timestamps
|
||||
model.record_timestamps = false
|
||||
|
||||
if block.arity.abs == 1
|
||||
# negative arity means arguments are optional
|
||||
if block.arity == 1 || block.arity < 0
|
||||
block.call(model)
|
||||
else
|
||||
block.call
|
||||
|
|
|
@ -237,3 +237,11 @@
|
|||
category: code_review
|
||||
aggregation: weekly
|
||||
feature_flag: diff_searching_usage_data
|
||||
- name: i_code_review_total_suggestions_applied
|
||||
redis_slot: code_review
|
||||
category: code_review
|
||||
aggregation: weekly
|
||||
- name: i_code_review_total_suggestions_added
|
||||
redis_slot: code_review
|
||||
category: code_review
|
||||
aggregation: weekly
|
||||
|
|
|
@ -20,8 +20,10 @@ module Gitlab
|
|||
MR_CREATE_MULTILINE_COMMENT_ACTION = 'i_code_review_user_create_multiline_mr_comment'
|
||||
MR_EDIT_MULTILINE_COMMENT_ACTION = 'i_code_review_user_edit_multiline_mr_comment'
|
||||
MR_REMOVE_MULTILINE_COMMENT_ACTION = 'i_code_review_user_remove_multiline_mr_comment'
|
||||
MR_ADD_SUGGESTION_ACTION = 'i_code_review_user_add_suggestion'
|
||||
MR_APPLY_SUGGESTION_ACTION = 'i_code_review_user_apply_suggestion'
|
||||
MR_USER_ADD_SUGGESTION_ACTION = 'i_code_review_user_add_suggestion'
|
||||
MR_TOTAL_ADD_SUGGESTION_ACTION = 'i_code_review_total_suggestions_added'
|
||||
MR_USER_APPLY_SUGGESTION_ACTION = 'i_code_review_user_apply_suggestion'
|
||||
MR_TOTAL_APPLY_SUGGESTION_ACTION = 'i_code_review_total_suggestions_applied'
|
||||
MR_MARKED_AS_DRAFT_ACTION = 'i_code_review_user_marked_as_draft'
|
||||
MR_UNMARKED_AS_DRAFT_ACTION = 'i_code_review_user_unmarked_as_draft'
|
||||
MR_RESOLVE_THREAD_ACTION = 'i_code_review_user_resolve_thread'
|
||||
|
@ -112,8 +114,9 @@ module Gitlab
|
|||
track_unique_action_by_user(MR_PUBLISH_REVIEW_ACTION, user)
|
||||
end
|
||||
|
||||
def track_add_suggestion_action(user:)
|
||||
track_unique_action_by_user(MR_ADD_SUGGESTION_ACTION, user)
|
||||
def track_add_suggestion_action(note:)
|
||||
track_unique_action_by_user(MR_USER_ADD_SUGGESTION_ACTION, note.author)
|
||||
track_unique_action_by_objects(MR_TOTAL_ADD_SUGGESTION_ACTION, note.suggestions)
|
||||
end
|
||||
|
||||
def track_marked_as_draft_action(user:)
|
||||
|
@ -124,16 +127,17 @@ module Gitlab
|
|||
track_unique_action_by_user(MR_UNMARKED_AS_DRAFT_ACTION, user)
|
||||
end
|
||||
|
||||
def track_apply_suggestion_action(user:)
|
||||
track_unique_action_by_user(MR_APPLY_SUGGESTION_ACTION, user)
|
||||
def track_apply_suggestion_action(user:, suggestions:)
|
||||
track_unique_action_by_user(MR_USER_APPLY_SUGGESTION_ACTION, user)
|
||||
track_unique_action_by_objects(MR_TOTAL_APPLY_SUGGESTION_ACTION, suggestions)
|
||||
end
|
||||
|
||||
def track_users_assigned_to_mr(users:)
|
||||
track_unique_action_by_users(MR_ASSIGNED_USERS_ACTION, users)
|
||||
track_unique_action_by_objects(MR_ASSIGNED_USERS_ACTION, users)
|
||||
end
|
||||
|
||||
def track_users_review_requested(users:)
|
||||
track_unique_action_by_users(MR_REVIEW_REQUESTED_USERS_ACTION, users)
|
||||
track_unique_action_by_objects(MR_REVIEW_REQUESTED_USERS_ACTION, users)
|
||||
end
|
||||
|
||||
def track_title_edit_action(user:)
|
||||
|
@ -222,10 +226,10 @@ module Gitlab
|
|||
track_unique_action(action, user.id)
|
||||
end
|
||||
|
||||
def track_unique_action_by_users(action, users)
|
||||
return if users.blank?
|
||||
def track_unique_action_by_objects(action, objects)
|
||||
return if objects.blank?
|
||||
|
||||
track_unique_action(action, users.map(&:id))
|
||||
track_unique_action(action, objects.map(&:id))
|
||||
end
|
||||
|
||||
def track_unique_action(action, value)
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace :gitlab do
|
|||
|
||||
desc 'GitLab | GraphQL | Generate GraphQL docs'
|
||||
task compile_docs: [:environment, :enable_feature_flags] do
|
||||
renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, render_options)
|
||||
renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, **render_options)
|
||||
|
||||
renderer.write
|
||||
|
||||
|
@ -120,7 +120,7 @@ namespace :gitlab do
|
|||
|
||||
desc 'GitLab | GraphQL | Check if GraphQL docs are up to date'
|
||||
task check_docs: [:environment, :enable_feature_flags] do
|
||||
renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, render_options)
|
||||
renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, **render_options)
|
||||
|
||||
doc = File.read(Rails.root.join(OUTPUT_DIR, 'index.md'))
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'set'
|
||||
require 'fileutils'
|
||||
|
||||
class String
|
||||
def red
|
||||
|
|
|
@ -317,7 +317,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
|
|||
it 'denies sign-in if sign-up is enabled, but block_auto_created_users is set' do
|
||||
post :atlassian_oauth2
|
||||
|
||||
expect(flash[:alert]).to start_with 'Your account has been blocked.'
|
||||
expect(flash[:alert]).to start_with 'Your account is pending approval'
|
||||
end
|
||||
|
||||
it 'accepts sign-in if sign-up is enabled' do
|
||||
|
@ -399,7 +399,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
|
|||
it 'denies login if sign up is enabled, but block_auto_created_users is set' do
|
||||
post :saml, params: { SAMLResponse: mock_saml_response }
|
||||
|
||||
expect(flash[:alert]).to start_with 'Your account has been blocked.'
|
||||
expect(flash[:alert]).to start_with 'Your account is pending approval'
|
||||
end
|
||||
|
||||
it 'accepts login if sign up is enabled' do
|
||||
|
|
|
@ -15,7 +15,7 @@ RSpec.describe 'Code review events' do
|
|||
|
||||
code_review_events = Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category("code_review")
|
||||
|
||||
exceptions = %w[i_code_review_mr_diffs i_code_review_mr_single_file_diffs]
|
||||
exceptions = %w[i_code_review_mr_diffs i_code_review_mr_single_file_diffs i_code_review_total_suggestions_applied i_code_review_total_suggestions_added]
|
||||
code_review_aggregated_events += exceptions
|
||||
|
||||
expect(code_review_events - code_review_aggregated_events).to be_empty
|
||||
|
|
|
@ -206,18 +206,32 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl
|
|||
end
|
||||
|
||||
describe '.track_add_suggestion_action' do
|
||||
subject { described_class.track_add_suggestion_action(user: user) }
|
||||
subject { described_class.track_add_suggestion_action(note: note) }
|
||||
|
||||
before do
|
||||
note.suggestions << build(:suggestion, id: 1, note: note)
|
||||
end
|
||||
|
||||
it_behaves_like 'a tracked merge request unique event' do
|
||||
let(:action) { described_class::MR_ADD_SUGGESTION_ACTION }
|
||||
let(:action) { described_class::MR_USER_ADD_SUGGESTION_ACTION }
|
||||
end
|
||||
|
||||
it_behaves_like 'a tracked merge request unique event' do
|
||||
let(:action) { described_class::MR_TOTAL_ADD_SUGGESTION_ACTION }
|
||||
end
|
||||
end
|
||||
|
||||
describe '.track_apply_suggestion_action' do
|
||||
subject { described_class.track_apply_suggestion_action(user: user) }
|
||||
subject { described_class.track_apply_suggestion_action(user: user, suggestions: suggestions) }
|
||||
|
||||
let(:suggestions) { [build(:suggestion, id: 1, note: note)] }
|
||||
|
||||
it_behaves_like 'a tracked merge request unique event' do
|
||||
let(:action) { described_class::MR_APPLY_SUGGESTION_ACTION }
|
||||
let(:action) { described_class::MR_USER_APPLY_SUGGESTION_ACTION }
|
||||
end
|
||||
|
||||
it_behaves_like 'a tracked merge request unique event' do
|
||||
let(:action) { described_class::MR_TOTAL_APPLY_SUGGESTION_ACTION }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ RSpec.describe UpdateMinimumPasswordLength do
|
|||
|
||||
before do
|
||||
stub_const('ApplicationSetting::DEFAULT_MINIMUM_PASSWORD_LENGTH', 10)
|
||||
allow(Devise.password_length).to receive(:min).and_return(12)
|
||||
allow(Devise).to receive(:password_length).and_return(12..20)
|
||||
end
|
||||
|
||||
it 'correctly migrates minimum_password_length' do
|
||||
|
|
|
@ -857,12 +857,8 @@ RSpec.describe User do
|
|||
end
|
||||
|
||||
context 'maximum value' do
|
||||
before do
|
||||
allow(Devise.password_length).to receive(:max).and_return(201)
|
||||
end
|
||||
|
||||
it 'is determined by the current value of `Devise.password_length.max`' do
|
||||
expect(password_length.max).to eq(201)
|
||||
expect(password_length.max).to eq(Devise.password_length.max)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -79,7 +79,7 @@ RSpec.describe Suggestions::ApplyService do
|
|||
it 'tracks apply suggestion event' do
|
||||
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
|
||||
.to receive(:track_apply_suggestion_action)
|
||||
.with(user: user)
|
||||
.with(user: user, suggestions: suggestions)
|
||||
|
||||
apply(suggestions)
|
||||
end
|
||||
|
|
|
@ -159,7 +159,7 @@ RSpec.describe Suggestions::CreateService do
|
|||
it 'tracks add suggestion event' do
|
||||
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
|
||||
.to receive(:track_add_suggestion_action)
|
||||
.with(user: note.author)
|
||||
.with(note: note)
|
||||
|
||||
subject.execute
|
||||
end
|
||||
|
|
|
@ -34,10 +34,6 @@ RSpec.describe WikiPages::EventCreateService do
|
|||
it 'does not create an event' do
|
||||
expect { response }.not_to change(Event, :count)
|
||||
end
|
||||
|
||||
it 'does not create a metadata record' do
|
||||
expect { response }.not_to change(WikiPage::Meta, :count)
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns a successful response' do
|
||||
|
|
Loading…
Reference in a new issue