Commit c904db1a authored by Abdul Wadood's avatar Abdul Wadood

Fix Rails/SaveBang offenses in ee/spec/controllers

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