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:
- 'ee/spec/services/todo_service_spec.rb'
- 'ee/spec/services/update_build_minutes_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/shared_examples/features/protected_branches_access_control_shared_examples.rb'
- 'ee/spec/support/shared_examples/finders/geo/framework_registry_finder_shared_examples.rb'
......@@ -1306,12 +1305,6 @@ Rails/SaveBang:
- 'spec/services/users/repair_ldap_blocked_service_spec.rb'
- 'spec/services/verify_pages_domain_service_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/namespaces_helper.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
allow(node).to receive(:selective_sync?).and_return(value)
end
def stub_healthy_shards(shards)
::Gitlab::ShardHealthCache.update(Array(shards))
end
def create_project_on_shard(shard_name)
project = create(:project)
......
......@@ -37,7 +37,7 @@ module CycleAnalyticsHelpers
end
def create_cycle(user, project, issue, mr, milestone, pipeline)
issue.update(milestone: milestone)
issue.update!(milestone: milestone)
pipeline.run
ci_build = create(:ci_build, pipeline: pipeline, status: :success, author: user)
......
......@@ -35,9 +35,9 @@ module DesignManagementTestHelpers
def act_on_designs(designs, &block)
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|
yield.create(design: d, version: version)
yield.create!(design: d, version: version)
end
version
end
......
......@@ -10,7 +10,7 @@ module JiraServiceHelper
password = 'my-secret-password'
jira_issue_transition_id = '1'
jira_tracker.update(
jira_tracker.update!(
url: url, username: username, password: password,
jira_issue_transition_id: jira_issue_transition_id, active: true
)
......
......@@ -40,7 +40,7 @@ module LoginHelpers
if user_or_role.is_a?(User)
user_or_role
else
create(user_or_role)
create(user_or_role) # rubocop:disable Rails/SaveBang
end
gitlab_sign_in_with(user, **kwargs)
......
......@@ -12,7 +12,7 @@ module NotificationHelpers
def create_global_setting_for(user, level)
setting = user.global_notification_setting
setting.level = level
setting.save
setting.save!
user
end
......@@ -27,7 +27,7 @@ module NotificationHelpers
def create_notification_setting(user, resource, level)
setting = user.notification_settings_for(resource)
setting.level = level
setting.save
setting.save!
end
# Create custom notifications
......
......@@ -37,7 +37,7 @@ module StubObjectStorage
Fog.mock!
::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
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