Commit 2bab5857 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'rails-save-bang-12' into 'master'

Fix Rails/SaveBang offenses for spec/support/helpers/** and ee/spec/support/helpers/*

See merge request gitlab-org/gitlab!38995
parents 4de7c8fd 6aba13ab
...@@ -862,7 +862,6 @@ Rails/SaveBang: ...@@ -862,7 +862,6 @@ Rails/SaveBang:
- 'ee/spec/services/todo_service_spec.rb' - 'ee/spec/services/todo_service_spec.rb'
- 'ee/spec/services/update_build_minutes_service_spec.rb' - 'ee/spec/services/update_build_minutes_service_spec.rb'
- 'ee/spec/services/vulnerability_feedback/create_service_spec.rb' - 'ee/spec/services/vulnerability_feedback/create_service_spec.rb'
- 'ee/spec/support/helpers/ee/geo_helpers.rb'
- 'ee/spec/support/protected_tags/access_control_shared_examples.rb' - 'ee/spec/support/protected_tags/access_control_shared_examples.rb'
- 'ee/spec/support/shared_examples/features/protected_branches_access_control_shared_examples.rb' - 'ee/spec/support/shared_examples/features/protected_branches_access_control_shared_examples.rb'
- 'ee/spec/support/shared_examples/finders/geo/framework_registry_finder_shared_examples.rb' - 'ee/spec/support/shared_examples/finders/geo/framework_registry_finder_shared_examples.rb'
...@@ -1306,12 +1305,6 @@ Rails/SaveBang: ...@@ -1306,12 +1305,6 @@ Rails/SaveBang:
- 'spec/services/users/repair_ldap_blocked_service_spec.rb' - 'spec/services/users/repair_ldap_blocked_service_spec.rb'
- 'spec/services/verify_pages_domain_service_spec.rb' - 'spec/services/verify_pages_domain_service_spec.rb'
- 'spec/sidekiq/cron/job_gem_dependency_spec.rb' - 'spec/sidekiq/cron/job_gem_dependency_spec.rb'
- 'spec/support/helpers/cycle_analytics_helpers.rb'
- 'spec/support/helpers/design_management_test_helpers.rb'
- 'spec/support/helpers/jira_service_helper.rb'
- 'spec/support/helpers/login_helpers.rb'
- 'spec/support/helpers/notification_helpers.rb'
- 'spec/support/helpers/stub_object_storage.rb'
- 'spec/support/migrations_helpers/cluster_helpers.rb' - 'spec/support/migrations_helpers/cluster_helpers.rb'
- 'spec/support/migrations_helpers/namespaces_helper.rb' - 'spec/support/migrations_helpers/namespaces_helper.rb'
- 'spec/support/shared_contexts/email_shared_context.rb' - 'spec/support/shared_contexts/email_shared_context.rb'
......
---
title: Refactor spec/support/helpers/* and ee/spec/support/helpers/* to fix Rails/SaveBang Cop
merge_request: 38995
author: Rajendra Kadam
type: fixed
...@@ -29,10 +29,6 @@ module EE ...@@ -29,10 +29,6 @@ module EE
allow(node).to receive(:selective_sync?).and_return(value) allow(node).to receive(:selective_sync?).and_return(value)
end end
def stub_healthy_shards(shards)
::Gitlab::ShardHealthCache.update(Array(shards))
end
def create_project_on_shard(shard_name) def create_project_on_shard(shard_name)
project = create(:project) project = create(:project)
......
...@@ -37,7 +37,7 @@ module CycleAnalyticsHelpers ...@@ -37,7 +37,7 @@ module CycleAnalyticsHelpers
end end
def create_cycle(user, project, issue, mr, milestone, pipeline) def create_cycle(user, project, issue, mr, milestone, pipeline)
issue.update(milestone: milestone) issue.update!(milestone: milestone)
pipeline.run pipeline.run
ci_build = create(:ci_build, pipeline: pipeline, status: :success, author: user) ci_build = create(:ci_build, pipeline: pipeline, status: :success, author: user)
......
...@@ -35,9 +35,9 @@ module DesignManagementTestHelpers ...@@ -35,9 +35,9 @@ module DesignManagementTestHelpers
def act_on_designs(designs, &block) def act_on_designs(designs, &block)
issue = designs.first.issue issue = designs.first.issue
version = build(:design_version, :empty, issue: issue).tap { |v| v.save(validate: false) } version = build(:design_version, :empty, issue: issue).tap { |v| v.save!(validate: false) }
designs.each do |d| designs.each do |d|
yield.create(design: d, version: version) yield.create!(design: d, version: version)
end end
version version
end end
......
...@@ -10,7 +10,7 @@ module JiraServiceHelper ...@@ -10,7 +10,7 @@ module JiraServiceHelper
password = 'my-secret-password' password = 'my-secret-password'
jira_issue_transition_id = '1' jira_issue_transition_id = '1'
jira_tracker.update( jira_tracker.update!(
url: url, username: username, password: password, url: url, username: username, password: password,
jira_issue_transition_id: jira_issue_transition_id, active: true jira_issue_transition_id: jira_issue_transition_id, active: true
) )
......
...@@ -40,7 +40,7 @@ module LoginHelpers ...@@ -40,7 +40,7 @@ module LoginHelpers
if user_or_role.is_a?(User) if user_or_role.is_a?(User)
user_or_role user_or_role
else else
create(user_or_role) create(user_or_role) # rubocop:disable Rails/SaveBang
end end
gitlab_sign_in_with(user, **kwargs) gitlab_sign_in_with(user, **kwargs)
......
...@@ -12,7 +12,7 @@ module NotificationHelpers ...@@ -12,7 +12,7 @@ module NotificationHelpers
def create_global_setting_for(user, level) def create_global_setting_for(user, level)
setting = user.global_notification_setting setting = user.global_notification_setting
setting.level = level setting.level = level
setting.save setting.save!
user user
end end
...@@ -27,7 +27,7 @@ module NotificationHelpers ...@@ -27,7 +27,7 @@ module NotificationHelpers
def create_notification_setting(user, resource, level) def create_notification_setting(user, resource, level)
setting = user.notification_settings_for(resource) setting = user.notification_settings_for(resource)
setting.level = level setting.level = level
setting.save setting.save!
end end
# Create custom notifications # Create custom notifications
......
...@@ -37,7 +37,7 @@ module StubObjectStorage ...@@ -37,7 +37,7 @@ module StubObjectStorage
Fog.mock! Fog.mock!
::Fog::Storage.new(connection_params).tap do |connection| ::Fog::Storage.new(connection_params).tap do |connection|
connection.directories.create(key: remote_directory) connection.directories.create(key: remote_directory) # rubocop:disable Rails/SaveBang
# Cleanup remaining files # Cleanup remaining files
connection.directories.each do |directory| connection.directories.each do |directory|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment