Commit 8bb75dff authored by Matthew Briedenhann's avatar Matthew Briedenhann Committed by Peter Leitzen

Fix Rails/SaveBang offenses

Fixed in spec/support/*
parent 45dcd491
......@@ -1165,11 +1165,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/migrations_helpers/cluster_helpers.rb'
- 'spec/support/migrations_helpers/namespaces_helper.rb'
- 'spec/support/shared_contexts/email_shared_context.rb'
- 'spec/support/shared_contexts/finders/group_projects_finder_shared_contexts.rb'
- 'spec/support/shared_contexts/mailers/notify_shared_context.rb'
# Offense count: 187
# Cop supports --auto-correct.
......
---
title: Fix Rails/SaveBang offenses in spec/support/*
merge_request: 44884
author: matthewbried
type: other
......@@ -4,7 +4,7 @@ module MigrationHelpers
module ClusterHelpers
# Creates a list of cluster projects.
def create_cluster_project_list(quantity)
group = namespaces_table.create(name: 'gitlab-org', path: 'gitlab-org')
group = namespaces_table.create!(name: 'gitlab-org', path: 'gitlab-org')
quantity.times do |id|
create_cluster_project(group, id)
......@@ -25,14 +25,14 @@ module MigrationHelpers
namespace_id: group.id
)
cluster = clusters_table.create(
cluster = clusters_table.create!(
name: 'test-cluster',
cluster_type: 3,
provider_type: :gcp,
platform_type: :kubernetes
)
cluster_projects_table.create(project_id: project.id, cluster_id: cluster.id)
cluster_projects_table.create!(project_id: project.id, cluster_id: cluster.id)
provider_gcp_table.create!(
gcp_project_id: "test-gcp-project-#{id}",
......@@ -43,7 +43,7 @@ module MigrationHelpers
zone: 'us-central1-a'
)
platform_kubernetes_table.create(
platform_kubernetes_table.create!(
cluster_id: cluster.id,
api_url: 'https://kubernetes.example.com',
encrypted_token: 'a' * 40,
......@@ -58,7 +58,7 @@ module MigrationHelpers
project = projects_table.find(cluster_project.project_id)
namespace = "#{project.path}-#{project.id}"
cluster_kubernetes_namespaces_table.create(
cluster_kubernetes_namespaces_table.create!(
cluster_project_id: cluster_project.id,
cluster_id: cluster.id,
project_id: cluster_project.project_id,
......
......@@ -3,7 +3,7 @@
module MigrationHelpers
module NamespacesHelpers
def create_namespace(name, visibility, options = {})
table(:namespaces).create({
table(:namespaces).create!({
name: name,
path: name,
type: 'Group',
......
......@@ -21,7 +21,7 @@ end
RSpec.shared_examples :reply_processing_shared_examples do
context "when the user could not be found" do
before do
user.destroy
user.destroy!
end
it "raises a UserNotFoundError" do
......
......@@ -18,8 +18,8 @@ RSpec.shared_context 'GroupProjectsFinder context' do
let!(:subgroup_private_project) { create(:project, :private, path: '7', group: subgroup) }
before do
shared_project_1.project_group_links.create(group_access: Gitlab::Access::MAINTAINER, group: group)
shared_project_2.project_group_links.create(group_access: Gitlab::Access::MAINTAINER, group: group)
shared_project_3.project_group_links.create(group_access: Gitlab::Access::MAINTAINER, group: group)
shared_project_1.project_group_links.create!(group_access: Gitlab::Access::MAINTAINER, group: group)
shared_project_2.project_group_links.create!(group_access: Gitlab::Access::MAINTAINER, group: group)
shared_project_3.project_group_links.create!(group_access: Gitlab::Access::MAINTAINER, group: group)
end
end
......@@ -11,7 +11,7 @@ RSpec.shared_context 'gitlab email notification' do
let(:new_user_address) { 'newguy@example.com' }
before do
email = recipient.emails.create(email: "notifications@example.com")
email = recipient.emails.create!(email: "notifications@example.com")
recipient.update_attribute(:notification_email, email.email)
stub_incoming_email_setting(enabled: true, address: "reply+%{key}@#{Gitlab.config.gitlab.host}")
end
......
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