Commit 280731e1 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'rails-save-bang-ee-spec-controllers' into 'master'

Fix Rails/SaveBang offenses in ee/spec/controllers

See merge request gitlab-org/gitlab!58087
parents 1b12d972 c1cc3f96
......@@ -29,8 +29,6 @@ Graphql/Descriptions:
# WIP: See https://gitlab.com/gitlab-org/gitlab/-/issues/220040
Rails/SaveBang:
Exclude:
- 'ee/spec/controllers/projects/merge_requests_controller_spec.rb'
- 'ee/spec/controllers/subscriptions_controller_spec.rb'
- 'ee/spec/initializers/fog_google_https_private_urls_spec.rb'
- 'ee/spec/lib/analytics/merge_request_metrics_calculator_spec.rb'
- 'ee/spec/lib/ee/gitlab/auth/ldap/sync/group_spec.rb'
......
......@@ -68,7 +68,7 @@ RSpec.describe Projects::MergeRequestsController do
end
before do
project.update(approvals_before_merge: 2)
project.update!(approvals_before_merge: 2)
end
def update_merge_request(params = {})
......@@ -173,7 +173,7 @@ RSpec.describe Projects::MergeRequestsController do
shared_examples 'approvals_before_merge param' do
before do
project.update(approvals_before_merge: 2)
project.update!(approvals_before_merge: 2)
end
context 'approvals_before_merge not set for the existing MR' do
......@@ -312,11 +312,6 @@ RSpec.describe Projects::MergeRequestsController do
context 'when the MR target the fork' do
let(:merge_request) { create(:merge_request, title: 'This is targeting the fork', source_project: project, target_project: project) }
before do
project.add_developer(user)
project.update(approvals_before_merge: 0)
end
it_behaves_like 'approvals_before_merge param'
end
end
......
......@@ -237,7 +237,7 @@ RSpec.describe SubscriptionsController do
let(:group) { Group.new(path: 'foo') }
it 'returns the errors in json format' do
group.save
group.valid?
subject
expect(response.body).to include({ name: ["can't be blank"] }.to_json)
......@@ -247,7 +247,7 @@ RSpec.describe SubscriptionsController do
let(:group) { Group.new(path: 'foo', name: '<script>alert("attack")</script>') }
it 'returns the errors in json format' do
group.save
group.valid?
subject
expect(Gitlab::Json.parse(response.body)['name']).to match_array([Gitlab::Regex.group_name_regex_message, HtmlSafetyValidator.error_message])
......
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