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: ...@@ -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
...@@ -312,11 +312,6 @@ RSpec.describe Projects::MergeRequestsController do ...@@ -312,11 +312,6 @@ RSpec.describe Projects::MergeRequestsController do
context 'when the MR target the fork' 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) } 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' it_behaves_like 'approvals_before_merge param'
end end
end end
......
...@@ -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.valid?
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.valid?
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