Commit e6b12029 authored by Matthew Briedenhann's avatar Matthew Briedenhann Committed by Peter Leitzen

Fix Rails/SaveBang offenses for spec files in spec/support/shared_example/*

parent f2e77c33
......@@ -1144,15 +1144,6 @@ Rails/SaveBang:
- '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'
- 'spec/support/shared_examples/controllers/cache_control_shared_examples.rb'
- 'spec/support/shared_examples/controllers/githubish_import_controller_shared_examples.rb'
- 'spec/support/shared_examples/controllers/sessionless_auth_controller_shared_examples.rb'
- 'spec/support/shared_examples/features/editable_merge_request_shared_examples.rb'
- 'spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb'
- 'spec/support/shared_examples/policies/project_policy_shared_examples.rb'
- 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb'
- 'spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb'
- 'spec/support/shared_examples/serializers/note_entity_shared_examples.rb'
- 'spec/tasks/gitlab/web_hook_rake_spec.rb'
- 'spec/uploaders/file_uploader_spec.rb'
- 'spec/uploaders/object_storage_spec.rb'
---
title: Fix Rails/SaveBang offenses for spec files in spec/support/shared_example/*
merge_request: 44424
author: matthewbried
type: other
......@@ -2,7 +2,7 @@
RSpec.shared_examples 'project cache control headers' do
before do
project.update(visibility_level: visibility_level)
project.update!(visibility_level: visibility_level)
end
context 'when project is public' do
......
......@@ -262,7 +262,7 @@ RSpec.shared_examples 'a GitHub-ish import controller: POST create' do
context "when the namespace is owned by the GitLab user" do
before do
user.username = other_username
user.save
user.save!
end
it "takes the existing namespace" do
......
......@@ -44,7 +44,7 @@ RSpec.shared_examples 'authenticates sessionless user' do |path, format, params|
.to increment(:user_unauthenticated_counter)
end
personal_access_token.update(scopes: [:read_user])
personal_access_token.update!(scopes: [:read_user])
get path, params: default_params.merge(private_token: personal_access_token.token)
......
......@@ -82,7 +82,7 @@ RSpec.shared_examples 'an editable merge request' do
end
it 'warns about version conflict' do
merge_request.update(title: "New title")
merge_request.update!(title: "New title")
fill_in 'merge_request_title', with: 'bug 345'
fill_in 'merge_request_description', with: 'bug description'
......
......@@ -227,7 +227,7 @@ RSpec.shared_examples 'common trace features' do
let(:token) { 'my_secret_token' }
before do
build.project.update(runners_token: token)
build.project.update!(runners_token: token)
trace.append(token, 0)
end
......@@ -240,7 +240,7 @@ RSpec.shared_examples 'common trace features' do
let(:token) { 'my_secret_token' }
before do
build.update(token: token)
build.update!(token: token)
trace.append(token, 0)
end
......@@ -531,7 +531,7 @@ RSpec.shared_examples 'trace with disabled live trace feature' do
context "when erase old trace with 'save'" do
before do
build.send(:write_attribute, :trace, nil)
build.save
build.save # rubocop:disable Rails/SaveBang
end
it 'old trace is not deleted' do
......
......@@ -109,7 +109,7 @@ RSpec.shared_examples 'issuable quick actions' do
QuickAction.new(
action_text: "/unlock",
before_action: -> {
issuable.update(discussion_locked: true)
issuable.update!(discussion_locked: true)
},
expectation: ->(noteable, can_use_quick_action) {
if can_use_quick_action
......@@ -128,7 +128,7 @@ RSpec.shared_examples 'issuable quick actions' do
QuickAction.new(
action_text: "/remove_milestone",
before_action: -> {
issuable.update(milestone_id: milestone.id)
issuable.update!(milestone_id: milestone.id)
},
expectation: ->(noteable, can_use_quick_action) {
if can_use_quick_action
......@@ -171,7 +171,7 @@ RSpec.shared_examples 'issuable quick actions' do
QuickAction.new(
action_text: "/remove_estimate",
before_action: -> {
issuable.update(time_estimate: 30000)
issuable.update!(time_estimate: 30000)
},
expectation: ->(noteable, can_use_quick_action) {
if can_use_quick_action
......@@ -228,7 +228,7 @@ RSpec.shared_examples 'issuable quick actions' do
before do
project.add_developer(old_assignee)
issuable.update(assignees: [old_assignee])
issuable.update!(assignees: [old_assignee])
end
context 'when user can update issuable' do
......
......@@ -52,7 +52,7 @@ RSpec.shared_examples 'merge quick action' do
context 'when the head diff changes in the meanwhile' do
before do
merge_request.source_branch = 'another_branch'
merge_request.save
merge_request.save!
sign_in(user)
visit project_merge_request_path(project, merge_request)
end
......
......@@ -24,7 +24,7 @@ RSpec.shared_examples 'note entity' do
context 'when note was edited' do
before do
note.update(updated_at: 1.minute.from_now, updated_by: user)
note.update!(updated_at: 1.minute.from_now, updated_by: user)
end
it 'exposes last_edited_at and last_edited_by elements' do
......@@ -34,7 +34,7 @@ RSpec.shared_examples 'note entity' do
context 'when note is a system note' do
before do
note.update(system: true)
note.update!(system: true)
end
it 'exposes system_note_icon_name element' do
......
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