Commit c45fe83d authored by Suraj Tripathi's avatar Suraj Tripathi Committed by Dylan Griffith

Fixed SaveBangs in /ee/spec/models/ee/*

parent 8f84338e
......@@ -52,11 +52,6 @@ Rails/SaveBang:
- 'ee/spec/models/approval_merge_request_rule_spec.rb'
- 'ee/spec/models/approval_project_rule_spec.rb'
- 'ee/spec/models/burndown_spec.rb'
- 'ee/spec/models/ee/appearance_spec.rb'
- 'ee/spec/models/ee/ci/job_artifact_spec.rb'
- 'ee/spec/models/ee/protected_branch_spec.rb'
- 'ee/spec/models/ee/protected_ref_access_spec.rb'
- 'ee/spec/models/ee/protected_ref_spec.rb'
- 'ee/spec/models/elasticsearch_indexed_namespace_spec.rb'
- 'ee/spec/models/environment_spec.rb'
- 'ee/spec/models/epic_spec.rb'
......
---
title: Fix Rails/SaveBang Rubocop offenses for ee models
merge_request: 61709
author: Suraj Tripathi @surajtripathy07
type: fixed
......@@ -53,7 +53,7 @@ RSpec.describe Appearance do
appearance = create(:appearance, :with_header_logo, :with_logo)
expect do
appearance.update(header_logo: fixture_file_upload('spec/fixtures/rails_sample.jpg'))
appearance.update!(header_logo: fixture_file_upload('spec/fixtures/rails_sample.jpg'))
end.to change(Geo::UploadDeletedEvent, :count).by(1)
end
end
......
......@@ -18,7 +18,7 @@ RSpec.describe Ci::JobArtifact do
job_artifact = create(:ee_ci_job_artifact, :archive)
expect do
job_artifact.destroy
job_artifact.destroy!
end.to change { Geo::JobArtifactDeletedEvent.count }.by(1)
end
end
......@@ -174,7 +174,7 @@ RSpec.describe Ci::JobArtifact do
with_them do
subject(:job_artifact_included) { described_class.replicables_for_current_secondary(ci_job_artifact).exists? }
let(:project) { create(*project_factory) }
let(:project) { create(*project_factory) } # rubocop:disable Rails/SaveBang
let(:ci_build) { create(:ci_build, project: project) }
let(:node) do
create(:geo_node_with_selective_sync_for,
......
......@@ -47,7 +47,7 @@ RSpec.describe ProtectedBranch do
it "does not count a group-based #{human_association_name} with an `access_level` set" do
group = create(:group)
protected_branch = create(:protected_branch, default_access_level: false)
protected_branch.project.project_group_links.create(group: group)
protected_branch.project.project_group_links.create!(group: group)
protected_branch.send(association_name) << build(factory_name, group: group, access_level: Gitlab::Access::MAINTAINER)
protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MAINTAINER)
......@@ -93,8 +93,8 @@ RSpec.describe ProtectedBranch do
first_protected_branch = create(:protected_branch, default_access_level: false)
second_protected_branch = create(:protected_branch, default_access_level: false)
first_protected_branch.project.project_group_links.create(group: group)
second_protected_branch.project.project_group_links.create(group: group)
first_protected_branch.project.project_group_links.create!(group: group)
second_protected_branch.project.project_group_links.create!(group: group)
first_protected_branch.send(association_name) << build(factory_name, group: group)
second_protected_branch.send(association_name) << build(factory_name, group: group)
......@@ -109,7 +109,7 @@ RSpec.describe ProtectedBranch do
it "ignores the `access_level` while validating a group-based #{human_association_name}" do
protected_branch = create(:protected_branch, default_access_level: false)
protected_branch.project.project_group_links.create(group: group)
protected_branch.project.project_group_links.create!(group: group)
protected_branch.send(association_name) << build(factory_name, access_level: Gitlab::Access::MAINTAINER)
protected_branch.send(association_name) << build(factory_name, group: group, access_level: Gitlab::Access::MAINTAINER)
......
......@@ -17,7 +17,7 @@ RSpec.describe EE::ProtectedRefAccess do
before do
project.add_developer(user)
project.project_group_links.create(group: group)
project.project_group_links.create!(group: group)
end
it "#{included_in_class} includes {described_class}" do
......@@ -104,8 +104,8 @@ RSpec.describe EE::ProtectedRefAccess do
it "doesn't require access_level if group specified" do
subject = build(factory_name, access_level: nil, group: create(:group))
subject.project.save
subject.project.project_group_links.create(group: subject.group)
subject.project.save!
subject.project.project_group_links.create!(group: subject.group)
expect(subject).to be_valid
end
......
......@@ -9,7 +9,7 @@ RSpec.describe EE::ProtectedRef do
2.times do
group = create(:group)
protected_branch.project.project_group_links.create(group: group)
protected_branch.project.project_group_links.create!(group: group)
protected_branch.merge_access_levels.create!(group: group)
end
......@@ -19,7 +19,7 @@ RSpec.describe EE::ProtectedRef do
protected_branch.push_access_levels.create!(user: user)
end
protected_branch.destroy
protected_branch.destroy!
expect(ProtectedBranch::MergeAccessLevel.count).to be(0)
expect(ProtectedBranch::PushAccessLevel.count).to be(0)
......
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