Commit 6e09867c authored by Peter Leitzen's avatar Peter Leitzen

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

Fix rubocop offenses for spec/support/shared_examples/requests/* and ee/spec/support/shared_examples/requests/*

See merge request gitlab-org/gitlab!40185
parents ab47a478 a728828c
...@@ -1033,8 +1033,6 @@ Rails/SaveBang: ...@@ -1033,8 +1033,6 @@ Rails/SaveBang:
- 'ee/spec/support/shared_examples/models/member_shared_examples.rb' - 'ee/spec/support/shared_examples/models/member_shared_examples.rb'
- 'ee/spec/support/shared_examples/models/mentionable_shared_examples.rb' - 'ee/spec/support/shared_examples/models/mentionable_shared_examples.rb'
- 'ee/spec/support/shared_examples/policies/protected_environments_shared_examples.rb' - 'ee/spec/support/shared_examples/policies/protected_environments_shared_examples.rb'
- 'ee/spec/support/shared_examples/requests/api/graphql/geo/registries_shared_examples.rb'
- 'ee/spec/support/shared_examples/requests/api/project_approval_rules_api_shared_examples.rb'
- 'ee/spec/support/shared_examples/services/build_execute_shared_examples.rb' - 'ee/spec/support/shared_examples/services/build_execute_shared_examples.rb'
- 'ee/spec/support/shared_examples/services/issue_epic_shared_examples.rb' - 'ee/spec/support/shared_examples/services/issue_epic_shared_examples.rb'
- 'ee/spec/workers/adjourned_project_deletion_worker_spec.rb' - 'ee/spec/workers/adjourned_project_deletion_worker_spec.rb'
...@@ -1489,11 +1487,6 @@ Rails/SaveBang: ...@@ -1489,11 +1487,6 @@ Rails/SaveBang:
- 'spec/support/shared_examples/policies/project_policy_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/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/quick_actions/merge_request/merge_quick_action_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/award_emoji_todo_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/boards_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/custom_attributes_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/nuget_packages_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/pypi_packages_shared_examples.rb'
- 'spec/support/shared_examples/serializers/note_entity_shared_examples.rb' - 'spec/support/shared_examples/serializers/note_entity_shared_examples.rb'
- 'spec/support/shared_examples/services/common_system_notes_shared_examples.rb' - 'spec/support/shared_examples/services/common_system_notes_shared_examples.rb'
- 'spec/support/shared_examples/services/issuable_shared_examples.rb' - 'spec/support/shared_examples/services/issuable_shared_examples.rb'
......
---
title: Refactor ee/spec/support/shared_examples/requests/* and spec/support/shared_examples/requests/* to fix Rails/SaveBang Cop
merge_request: 40185
author: Rajendra Kadam
type: fixed
...@@ -12,8 +12,8 @@ RSpec.shared_examples 'gets registries for' do |args| ...@@ -12,8 +12,8 @@ RSpec.shared_examples 'gets registries for' do |args|
include EE::GeoHelpers include EE::GeoHelpers
let_it_be(:secondary) { create(:geo_node) } let_it_be(:secondary) { create(:geo_node) }
let!(:registry1) { create(registry_factory) } let!(:registry1) { create(registry_factory) } # rubocop:disable Rails/SaveBang
let!(:registry2) { create(registry_factory) } let!(:registry2) { create(registry_factory) } # rubocop:disable Rails/SaveBang
let(:query) do let(:query) do
<<~QUERY <<~QUERY
...@@ -54,8 +54,8 @@ RSpec.shared_examples 'gets registries for' do |args| ...@@ -54,8 +54,8 @@ RSpec.shared_examples 'gets registries for' do |args|
end end
context 'when paginating' do context 'when paginating' do
let!(:expected_registry1) { create(registry_factory) } let!(:expected_registry1) { create(registry_factory) } # rubocop:disable Rails/SaveBang
let!(:expected_registry2) { create(registry_factory) } let!(:expected_registry2) { create(registry_factory) } # rubocop:disable Rails/SaveBang
def query(registries_params) def query(registries_params)
<<~QUERY <<~QUERY
......
...@@ -38,7 +38,7 @@ RSpec.shared_examples 'an API endpoint for creating project approval rule' do ...@@ -38,7 +38,7 @@ RSpec.shared_examples 'an API endpoint for creating project approval rule' do
project.reset_approvals_on_push = false project.reset_approvals_on_push = false
project.disable_overriding_approvers_per_merge_request = true project.disable_overriding_approvers_per_merge_request = true
project.save project.save!
post api(url, current_user), params: params post api(url, current_user), params: params
...@@ -144,7 +144,7 @@ RSpec.shared_examples 'an API endpoint for updating project approval rule' do ...@@ -144,7 +144,7 @@ RSpec.shared_examples 'an API endpoint for updating project approval rule' do
context 'as a random user' do context 'as a random user' do
it 'returns 403' do it 'returns 403' do
project.approvers.create(user: approver) project.approvers.create!(user: approver)
expect do expect do
put api(url, user2), params: { users: [], groups: [] }.to_json, headers: { CONTENT_TYPE: 'application/json' } put api(url, user2), params: { users: [], groups: [] }.to_json, headers: { CONTENT_TYPE: 'application/json' }
......
...@@ -22,7 +22,7 @@ RSpec.shared_examples 'creating award emojis marks Todos as done' do ...@@ -22,7 +22,7 @@ RSpec.shared_examples 'creating award emojis marks Todos as done' do
with_them do with_them do
let(:project) { awardable.project } let(:project) { awardable.project }
let(:awardable) { create(type) } let(:awardable) { create(type) } # rubocop:disable Rails/SaveBang
let!(:todo) { create(:todo, target: awardable, project: project, user: user) } let!(:todo) { create(:todo, target: awardable, project: project, user: user) }
specify do specify do
......
...@@ -169,7 +169,7 @@ RSpec.shared_examples 'group and project boards' do |route_definition, ee = fals ...@@ -169,7 +169,7 @@ RSpec.shared_examples 'group and project boards' do |route_definition, ee = fals
before do before do
if board_parent.try(:namespace) if board_parent.try(:namespace)
board_parent.update(namespace: owner.namespace) board_parent.update!(namespace: owner.namespace)
else else
board.resource_parent.add_owner(owner) board.resource_parent.add_owner(owner)
end end
......
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_examples 'custom attributes endpoints' do |attributable_name| RSpec.shared_examples 'custom attributes endpoints' do |attributable_name|
let!(:custom_attribute1) { attributable.custom_attributes.create key: 'foo', value: 'foo' } let!(:custom_attribute1) { attributable.custom_attributes.create! key: 'foo', value: 'foo' }
let!(:custom_attribute2) { attributable.custom_attributes.create key: 'bar', value: 'bar' } let!(:custom_attribute2) { attributable.custom_attributes.create! key: 'bar', value: 'bar' }
describe "GET /#{attributable_name} with custom attributes filter" do describe "GET /#{attributable_name} with custom attributes filter" do
before do before do
......
...@@ -175,7 +175,7 @@ RSpec.shared_examples 'process nuget upload' do |user_type, status, add_member = ...@@ -175,7 +175,7 @@ RSpec.shared_examples 'process nuget upload' do |user_type, status, add_member =
context 'with object storage enabled' do context 'with object storage enabled' do
let(:tmp_object) do let(:tmp_object) do
fog_connection.directories.new(key: 'packages').files.create( fog_connection.directories.new(key: 'packages').files.create( # rubocop:disable Rails/SaveBang
key: "tmp/uploads/#{file_name}", key: "tmp/uploads/#{file_name}",
body: 'content' body: 'content'
) )
......
...@@ -58,7 +58,7 @@ RSpec.shared_examples 'PyPi package creation' do |user_type, status, add_member ...@@ -58,7 +58,7 @@ RSpec.shared_examples 'PyPi package creation' do |user_type, status, add_member
context 'with object storage enabled' do context 'with object storage enabled' do
let(:tmp_object) do let(:tmp_object) do
fog_connection.directories.new(key: 'packages').files.create( fog_connection.directories.new(key: 'packages').files.create( # rubocop:disable Rails/SaveBang
key: "tmp/uploads/#{file_name}", key: "tmp/uploads/#{file_name}",
body: 'content' body: 'content'
) )
......
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