Commit 0d1c0067 authored by Lin Jen-Shin's avatar Lin Jen-Shin

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

Fix Rails/SaveBang offenses in ee/spec/requests

See merge request gitlab-org/gitlab!58078
parents 3ed62a3b 442bc80f
...@@ -97,26 +97,6 @@ Rails/SaveBang: ...@@ -97,26 +97,6 @@ Rails/SaveBang:
- 'ee/spec/models/visible_approvable_spec.rb' - 'ee/spec/models/visible_approvable_spec.rb'
- 'ee/spec/models/vulnerabilities/feedback_spec.rb' - 'ee/spec/models/vulnerabilities/feedback_spec.rb'
- 'ee/spec/models/vulnerabilities/issue_link_spec.rb' - 'ee/spec/models/vulnerabilities/issue_link_spec.rb'
- 'ee/spec/requests/api/boards_spec.rb'
- 'ee/spec/requests/api/epic_issues_spec.rb'
- 'ee/spec/requests/api/epic_links_spec.rb'
- 'ee/spec/requests/api/epics_spec.rb'
- 'ee/spec/requests/api/geo_nodes_spec.rb'
- 'ee/spec/requests/api/geo_spec.rb'
- 'ee/spec/requests/api/graphql/group/epics_spec.rb'
- 'ee/spec/requests/api/graphql/mutations/epic_tree/reorder_spec.rb'
- 'ee/spec/requests/api/groups_spec.rb'
- 'ee/spec/requests/api/issues_spec.rb'
- 'ee/spec/requests/api/ldap_group_links_spec.rb'
- 'ee/spec/requests/api/merge_request_approval_rules_spec.rb'
- 'ee/spec/requests/api/merge_request_approvals_spec.rb'
- 'ee/spec/requests/api/merge_requests_spec.rb'
- 'ee/spec/requests/api/project_approvals_spec.rb'
- 'ee/spec/requests/api/projects_spec.rb'
- 'ee/spec/requests/api/protected_branches_spec.rb'
- 'ee/spec/requests/api/scim_spec.rb'
- 'ee/spec/requests/api/todos_spec.rb'
- 'ee/spec/requests/lfs_http_spec.rb'
- 'ee/spec/services/approval_rules/finalize_service_spec.rb' - 'ee/spec/services/approval_rules/finalize_service_spec.rb'
- 'ee/spec/services/approval_rules/update_service_spec.rb' - 'ee/spec/services/approval_rules/update_service_spec.rb'
- 'ee/spec/services/ee/boards/issues/create_service_spec.rb' - 'ee/spec/services/ee/boards/issues/create_service_spec.rb'
......
---
title: Fix Rails/SaveBang rubocop offenses in ee/spec/requests
merge_request: 58078
author: Abdul Wadood @abdulwd
type: fixed
...@@ -33,7 +33,7 @@ RSpec.describe API::Boards do ...@@ -33,7 +33,7 @@ RSpec.describe API::Boards do
let(:url) { "/projects/#{board_parent.id}/boards/#{board.id}" } let(:url) { "/projects/#{board_parent.id}/boards/#{board.id}" }
it 'returns board with Upcoming milestone' do it 'returns board with Upcoming milestone' do
board.update(milestone_id: Milestone::Upcoming.id) board.update!(milestone_id: Milestone::Upcoming.id)
get api(url, user) get api(url, user)
...@@ -41,7 +41,7 @@ RSpec.describe API::Boards do ...@@ -41,7 +41,7 @@ RSpec.describe API::Boards do
end end
it 'returns board with Started milestone' do it 'returns board with Started milestone' do
board.update(milestone_id: Milestone::Started.id) board.update!(milestone_id: Milestone::Started.id)
get api(url, user) get api(url, user)
......
...@@ -34,8 +34,8 @@ RSpec.describe API::EpicIssues do ...@@ -34,8 +34,8 @@ RSpec.describe API::EpicIssues do
end end
it 'returns 404 not found error for a user without permissions to see the group' do it 'returns 404 not found error for a user without permissions to see the group' do
project.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
group.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) group.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
get api(url, user) get api(url, user)
...@@ -112,8 +112,8 @@ RSpec.describe API::EpicIssues do ...@@ -112,8 +112,8 @@ RSpec.describe API::EpicIssues do
end end
it 'returns 404 not found error for a user without permissions to see the group' do it 'returns 404 not found error for a user without permissions to see the group' do
project.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
group.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) group.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
post api(url, user) post api(url, user)
...@@ -197,8 +197,8 @@ RSpec.describe API::EpicIssues do ...@@ -197,8 +197,8 @@ RSpec.describe API::EpicIssues do
end end
it 'returns 404 not found error for a user without permissions to see the group' do it 'returns 404 not found error for a user without permissions to see the group' do
project.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
group.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) group.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
delete api(url, user) delete api(url, user)
...@@ -282,8 +282,8 @@ RSpec.describe API::EpicIssues do ...@@ -282,8 +282,8 @@ RSpec.describe API::EpicIssues do
end end
it 'returns 404 not found error for a user without permissions to see the group' do it 'returns 404 not found error for a user without permissions to see the group' do
project.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
group.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) group.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
put api(url, user) put api(url, user)
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
......
...@@ -30,7 +30,7 @@ RSpec.describe API::EpicLinks do ...@@ -30,7 +30,7 @@ RSpec.describe API::EpicLinks do
end end
it 'returns 404 not found error for a user without permissions to see the group' do it 'returns 404 not found error for a user without permissions to see the group' do
group.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) group.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
subject subject
......
...@@ -27,8 +27,8 @@ RSpec.describe API::Epics do ...@@ -27,8 +27,8 @@ RSpec.describe API::Epics do
end end
it 'returns 404 not found error for a user without permissions to see the group' do it 'returns 404 not found error for a user without permissions to see the group' do
project.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
group.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) group.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
get api(url, user), params: params get api(url, user), params: params
...@@ -378,7 +378,7 @@ RSpec.describe API::Epics do ...@@ -378,7 +378,7 @@ RSpec.describe API::Epics do
let(:parent_group) { create(:group) } let(:parent_group) { create(:group) }
before do before do
group.update(parent_id: parent_group.id) group.update!(parent_id: parent_group.id)
end end
it 'exposes full reference path' do it 'exposes full reference path' do
......
...@@ -290,7 +290,7 @@ RSpec.describe API::GeoNodes, :request_store, :geo, :prometheus, api: true do ...@@ -290,7 +290,7 @@ RSpec.describe API::GeoNodes, :request_store, :geo, :prometheus, api: true do
end end
it 'enables the secondary node' do it 'enables the secondary node' do
secondary.update(enabled: false) secondary.update!(enabled: false)
put api("/geo_nodes/#{secondary.id}"), params: { enabled: true }, headers: geo_base_request.headers put api("/geo_nodes/#{secondary.id}"), params: { enabled: true }, headers: geo_base_request.headers
...@@ -299,7 +299,7 @@ RSpec.describe API::GeoNodes, :request_store, :geo, :prometheus, api: true do ...@@ -299,7 +299,7 @@ RSpec.describe API::GeoNodes, :request_store, :geo, :prometheus, api: true do
end end
it 'disables the secondary node' do it 'disables the secondary node' do
secondary.update(enabled: true) secondary.update!(enabled: true)
put api("/geo_nodes/#{secondary.id}"), params: { enabled: false }, headers: geo_base_request.headers put api("/geo_nodes/#{secondary.id}"), params: { enabled: false }, headers: geo_base_request.headers
......
...@@ -189,7 +189,7 @@ RSpec.describe API::Geo do ...@@ -189,7 +189,7 @@ RSpec.describe API::Geo do
context 'when attachment has mount_point nil' do context 'when attachment has mount_point nil' do
it 'responds with 200 with X-Sendfile' do it 'responds with 200 with X-Sendfile' do
resource.update(mount_point: nil) resource.update!(mount_point: nil)
get api("/geo/transfers/attachment/#{resource.id}"), headers: req_header get api("/geo/transfers/attachment/#{resource.id}"), headers: req_header
...@@ -224,7 +224,7 @@ RSpec.describe API::Geo do ...@@ -224,7 +224,7 @@ RSpec.describe API::Geo do
context 'avatar has mount_point nil' do context 'avatar has mount_point nil' do
it 'responds with 200 with X-Sendfile' do it 'responds with 200 with X-Sendfile' do
resource.update(mount_point: nil) resource.update!(mount_point: nil)
get api("/geo/transfers/avatar/#{resource.id}"), headers: req_header get api("/geo/transfers/avatar/#{resource.id}"), headers: req_header
...@@ -432,7 +432,7 @@ RSpec.describe API::Geo do ...@@ -432,7 +432,7 @@ RSpec.describe API::Geo do
end end
it 'ignores invalid attributes upon update' do it 'ignores invalid attributes upon update' do
GeoNodeStatus.create(data) GeoNodeStatus.create!(data)
data.merge!( data.merge!(
{ {
'id' => nil, 'id' => nil,
......
...@@ -188,7 +188,7 @@ RSpec.describe 'Epics through GroupQuery' do ...@@ -188,7 +188,7 @@ RSpec.describe 'Epics through GroupQuery' do
end.count end.count
epics_with_parent = create_list(:epic, 3, group: group) do |epic| epics_with_parent = create_list(:epic, 3, group: group) do |epic|
epic.update(parent: create(:epic, group: group)) epic.update!(parent: create(:epic, group: group))
end end
group.reload group.reload
...@@ -219,8 +219,8 @@ RSpec.describe 'Epics through GroupQuery' do ...@@ -219,8 +219,8 @@ RSpec.describe 'Epics through GroupQuery' do
end end
it 'returns a nil group for a user without permissions to see the group' do it 'returns a nil group for a user without permissions to see the group' do
project.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
group.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) group.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
post_graphql(query, current_user: user) post_graphql(query, current_user: user)
......
...@@ -88,7 +88,7 @@ RSpec.describe 'Updating an epic tree' do ...@@ -88,7 +88,7 @@ RSpec.describe 'Updating an epic tree' do
before do before do
other_epic = create(:epic, group: group) other_epic = create(:epic, group: group)
epic2.update(parent: other_epic) epic2.update!(parent: other_epic)
end end
it 'updates the epics relative positions and updates the parent' do it 'updates the epics relative positions and updates the parent' do
...@@ -149,7 +149,7 @@ RSpec.describe 'Updating an epic tree' do ...@@ -149,7 +149,7 @@ RSpec.describe 'Updating an epic tree' do
before do before do
stub_licensed_features(epics: true, subepics: false) stub_licensed_features(epics: true, subepics: false)
other_epic = create(:epic, group: group) other_epic = create(:epic, group: group)
epic2.update(parent: other_epic) epic2.update!(parent: other_epic)
end end
it_behaves_like 'a mutation that does not update the tree' it_behaves_like 'a mutation that does not update the tree'
...@@ -185,7 +185,7 @@ RSpec.describe 'Updating an epic tree' do ...@@ -185,7 +185,7 @@ RSpec.describe 'Updating an epic tree' do
before do before do
other_epic = create(:epic, group: group) other_epic = create(:epic, group: group)
epic_issue2.update(epic: other_epic) epic_issue2.update!(epic: other_epic)
end end
it "updates the epic's relative positions and parent" do it "updates the epic's relative positions and parent" do
......
...@@ -14,7 +14,7 @@ RSpec.describe API::Groups do ...@@ -14,7 +14,7 @@ RSpec.describe API::Groups do
before do before do
group.add_owner(user) group.add_owner(user)
group.ldap_group_links.create cn: 'ldap-group', group_access: Gitlab::Access::MAINTAINER, provider: 'ldap' group.ldap_group_links.create! cn: 'ldap-group', group_access: Gitlab::Access::MAINTAINER, provider: 'ldap'
end end
shared_examples 'inaccessable by reporter role and lower' do shared_examples 'inaccessable by reporter role and lower' do
...@@ -211,7 +211,7 @@ RSpec.describe API::Groups do ...@@ -211,7 +211,7 @@ RSpec.describe API::Groups do
context 'when authenticated as the group owner' do context 'when authenticated as the group owner' do
it 'returns 200 if shared_runners_minutes_limit is not changing' do it 'returns 200 if shared_runners_minutes_limit is not changing' do
group.update(shared_runners_minutes_limit: 133) group.update!(shared_runners_minutes_limit: 133)
expect do expect do
put api("/groups/#{group.id}", user), params: { shared_runners_minutes_limit: 133 } put api("/groups/#{group.id}", user), params: { shared_runners_minutes_limit: 133 }
......
...@@ -47,7 +47,7 @@ RSpec.describe API::Issues, :mailer do ...@@ -47,7 +47,7 @@ RSpec.describe API::Issues, :mailer do
context 'and epic issue is not present' do context 'and epic issue is not present' do
it 'exposes epic as nil' do it 'exposes epic as nil' do
issue_with_epic.epic_issue.destroy issue_with_epic.epic_issue.destroy!
subject subject
......
...@@ -11,10 +11,10 @@ RSpec.describe API::LdapGroupLinks, api: true do ...@@ -11,10 +11,10 @@ RSpec.describe API::LdapGroupLinks, api: true do
let!(:group_with_ldap_links) do let!(:group_with_ldap_links) do
group = create(:group) group = create(:group)
group.ldap_group_links.create cn: 'ldap-group1', group_access: Gitlab::Access::MAINTAINER, provider: 'ldap1' group.ldap_group_links.create! cn: 'ldap-group1', group_access: Gitlab::Access::MAINTAINER, provider: 'ldap1'
group.ldap_group_links.create cn: 'ldap-group2', group_access: Gitlab::Access::MAINTAINER, provider: 'ldap2' group.ldap_group_links.create! cn: 'ldap-group2', group_access: Gitlab::Access::MAINTAINER, provider: 'ldap2'
group.ldap_group_links.create cn: 'ldap-group3', group_access: Gitlab::Access::MAINTAINER, provider: 'ldap2' group.ldap_group_links.create! cn: 'ldap-group3', group_access: Gitlab::Access::MAINTAINER, provider: 'ldap2'
group.ldap_group_links.create filter: '(uid=mary)', group_access: Gitlab::Access::DEVELOPER, provider: 'ldap2' group.ldap_group_links.create! filter: '(uid=mary)', group_access: Gitlab::Access::DEVELOPER, provider: 'ldap2'
group group
end end
......
...@@ -83,7 +83,7 @@ RSpec.describe API::MergeRequestApprovalRules do ...@@ -83,7 +83,7 @@ RSpec.describe API::MergeRequestApprovalRules do
before do before do
group.add_developer(approver) group.add_developer(approver)
merge_request.approvals.create(user: approver) merge_request.approvals.create!(user: approver)
get api(url, current_user) get api(url, current_user)
end end
......
...@@ -60,7 +60,7 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -60,7 +60,7 @@ RSpec.describe API::MergeRequestApprovals do
it 'retrieves the approval status' do it 'retrieves the approval status' do
project.add_developer(approver) project.add_developer(approver)
project.add_developer(create(:user)) project.add_developer(create(:user))
merge_request.approvals.create(user: approver) merge_request.approvals.create!(user: approver)
rule.users << approver rule.users << approver
rule.groups << group rule.groups << group
...@@ -105,7 +105,7 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -105,7 +105,7 @@ RSpec.describe API::MergeRequestApprovals do
before do before do
private_group = create(:group, :private) private_group = create(:group, :private)
private_group.add_developer(create(:user)) private_group.add_developer(create(:user))
merge_request.approver_groups.create(group: private_group) merge_request.approver_groups.create!(group: private_group)
end end
it 'hides private group' do it 'hides private group' do
...@@ -156,7 +156,7 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -156,7 +156,7 @@ RSpec.describe API::MergeRequestApprovals do
before do before do
project.add_developer(approver) project.add_developer(approver)
merge_request.approvals.create(user: approver) merge_request.approvals.create!(user: approver)
rule.users << approver rule.users << approver
end end
...@@ -250,7 +250,7 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -250,7 +250,7 @@ RSpec.describe API::MergeRequestApprovals do
before do before do
project.add_developer(approver) project.add_developer(approver)
merge_request.approvals.create(user: approver) merge_request.approvals.create!(user: approver)
rule.users << approver rule.users << approver
end end
...@@ -276,7 +276,7 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -276,7 +276,7 @@ RSpec.describe API::MergeRequestApprovals do
shared_examples_for 'user allowed to override approvals_before_merge' do shared_examples_for 'user allowed to override approvals_before_merge' do
context 'when disable_overriding_approvers_per_merge_request is false on the project' do context 'when disable_overriding_approvers_per_merge_request is false on the project' do
before do before do
project.update(disable_overriding_approvers_per_merge_request: false) project.update!(disable_overriding_approvers_per_merge_request: false)
end end
it 'allows you to set approvals required' do it 'allows you to set approvals required' do
...@@ -291,7 +291,7 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -291,7 +291,7 @@ RSpec.describe API::MergeRequestApprovals do
context 'when disable_overriding_approvers_per_merge_request is true on the project' do context 'when disable_overriding_approvers_per_merge_request is true on the project' do
before do before do
project.update(disable_overriding_approvers_per_merge_request: true) project.update!(disable_overriding_approvers_per_merge_request: true)
end end
it 'does not allow you to set approvals_before_merge' do it 'does not allow you to set approvals_before_merge' do
...@@ -320,7 +320,7 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -320,7 +320,7 @@ RSpec.describe API::MergeRequestApprovals do
context 'as a random user' do context 'as a random user' do
before do before do
project.update(disable_overriding_approvers_per_merge_request: false) project.update!(disable_overriding_approvers_per_merge_request: false)
end end
it 'does not allow you to override approvals required' do it 'does not allow you to override approvals required' do
...@@ -403,8 +403,8 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -403,8 +403,8 @@ RSpec.describe API::MergeRequestApprovals do
context 'when project requires force auth for approval' do context 'when project requires force auth for approval' do
before do before do
project.update(require_password_to_approve: true) project.update!(require_password_to_approve: true)
approver.update(password: 'password') approver.update!(password: 'password')
end end
it 'does not approve the merge request with no password' do it 'does not approve the merge request with no password' do
...@@ -431,7 +431,7 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -431,7 +431,7 @@ RSpec.describe API::MergeRequestApprovals do
it 'only shows group approvers visible to the user' do it 'only shows group approvers visible to the user' do
private_group = create(:group, :private) private_group = create(:group, :private)
merge_request.approver_groups.create(group: private_group) merge_request.approver_groups.create!(group: private_group)
approve approve
...@@ -452,8 +452,8 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -452,8 +452,8 @@ RSpec.describe API::MergeRequestApprovals do
project.add_developer(approver) project.add_developer(approver)
project.add_developer(unapprover) project.add_developer(unapprover)
project.add_developer(create(:user)) project.add_developer(create(:user))
merge_request.approvals.create(user: approver) merge_request.approvals.create!(user: approver)
merge_request.approvals.create(user: unapprover) merge_request.approvals.create!(user: unapprover)
rule.users = [approver, unapprover] rule.users = [approver, unapprover]
end end
...@@ -473,7 +473,7 @@ RSpec.describe API::MergeRequestApprovals do ...@@ -473,7 +473,7 @@ RSpec.describe API::MergeRequestApprovals do
it 'only shows group approvers visible to the user' do it 'only shows group approvers visible to the user' do
private_group = create(:group, :private) private_group = create(:group, :private)
merge_request.approver_groups.create(group: private_group) merge_request.approver_groups.create!(group: private_group)
post api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/unapprove", unapprover) post api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/unapprove", unapprover)
......
...@@ -145,7 +145,7 @@ RSpec.describe API::MergeRequests do ...@@ -145,7 +145,7 @@ RSpec.describe API::MergeRequests do
context 'the approvals_before_merge param' do context 'the approvals_before_merge param' do
context 'when the target project has disable_overriding_approvers_per_merge_request set to true' do context 'when the target project has disable_overriding_approvers_per_merge_request set to true' do
before do before do
project.update(disable_overriding_approvers_per_merge_request: true) project.update!(disable_overriding_approvers_per_merge_request: true)
create_merge_request(approvals_before_merge: 1) create_merge_request(approvals_before_merge: 1)
end end
...@@ -156,7 +156,7 @@ RSpec.describe API::MergeRequests do ...@@ -156,7 +156,7 @@ RSpec.describe API::MergeRequests do
context 'when the target project has disable_overriding_approvers_per_merge_request set to false' do context 'when the target project has disable_overriding_approvers_per_merge_request set to false' do
before do before do
project.update(approvals_before_merge: 0) project.update!(approvals_before_merge: 0)
create_merge_request(approvals_before_merge: 1) create_merge_request(approvals_before_merge: 1)
end end
...@@ -173,7 +173,7 @@ RSpec.describe API::MergeRequests do ...@@ -173,7 +173,7 @@ RSpec.describe API::MergeRequests do
describe "PUT /projects/:id/merge_requests/:merge_request_iid/merge" do describe "PUT /projects/:id/merge_requests/:merge_request_iid/merge" do
it 'returns 405 if merge request was not approved' do it 'returns 405 if merge request was not approved' do
project.add_developer(create(:user)) project.add_developer(create(:user))
project.update(approvals_before_merge: 1) project.update!(approvals_before_merge: 1)
put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user) put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user)
...@@ -184,8 +184,8 @@ RSpec.describe API::MergeRequests do ...@@ -184,8 +184,8 @@ RSpec.describe API::MergeRequests do
it 'returns 200 if merge request was approved' do it 'returns 200 if merge request was approved' do
approver = create(:user) approver = create(:user)
project.add_developer(approver) project.add_developer(approver)
project.update(approvals_before_merge: 1) project.update!(approvals_before_merge: 1)
merge_request.approvals.create(user: approver) merge_request.approvals.create!(user: approver)
put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user) put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/merge", user)
......
...@@ -77,7 +77,7 @@ RSpec.describe API::ProjectApprovals do ...@@ -77,7 +77,7 @@ RSpec.describe API::ProjectApprovals do
project.merge_requests_author_approval = false project.merge_requests_author_approval = false
project.merge_requests_disable_committers_approval = true project.merge_requests_disable_committers_approval = true
project.require_password_to_approve = false project.require_password_to_approve = false
project.save project.save!
settings = { settings = {
approvals_before_merge: 4, approvals_before_merge: 4,
...@@ -95,7 +95,7 @@ RSpec.describe API::ProjectApprovals do ...@@ -95,7 +95,7 @@ RSpec.describe API::ProjectApprovals do
it 'only shows approver groups that are visible to the current user' do it 'only shows approver groups that are visible to the current user' do
private_group = create(:group, :private) private_group = create(:group, :private)
project.approver_groups.create(group: private_group) project.approver_groups.create!(group: private_group)
post api(url, current_user), params: { approvals_before_merge: 3 } post api(url, current_user), params: { approvals_before_merge: 3 }
......
...@@ -171,7 +171,7 @@ RSpec.describe API::Projects do ...@@ -171,7 +171,7 @@ RSpec.describe API::Projects do
before do before do
create(:ip_restriction, group: group) create(:ip_restriction, group: group)
group.add_maintainer(user) group.add_maintainer(user)
project.update(namespace: group) project.update!(namespace: group)
end end
context 'when the group_ip_restriction feature is not available' do context 'when the group_ip_restriction feature is not available' do
...@@ -1019,7 +1019,7 @@ RSpec.describe API::Projects do ...@@ -1019,7 +1019,7 @@ RSpec.describe API::Projects do
end end
it 'restores project' do it 'restores project' do
project.update(archived: true, marked_for_deletion_at: 1.day.ago, deleting_user: user) project.update!(archived: true, marked_for_deletion_at: 1.day.ago, deleting_user: user)
post api("/projects/#{project.id}/restore", user) post api("/projects/#{project.id}/restore", user)
...@@ -1088,7 +1088,7 @@ RSpec.describe API::Projects do ...@@ -1088,7 +1088,7 @@ RSpec.describe API::Projects do
let(:group) { create(:group) } let(:group) { create(:group) }
before do before do
group.namespace_settings.update(delayed_project_removal: true) group.namespace_settings.update!(delayed_project_removal: true)
end end
it_behaves_like 'marks project for deletion' it_behaves_like 'marks project for deletion'
......
...@@ -29,8 +29,8 @@ RSpec.describe API::ProtectedBranches do ...@@ -29,8 +29,8 @@ RSpec.describe API::ProtectedBranches do
before do before do
project.add_developer(push_user) project.add_developer(push_user)
project.project_group_links.create(group: merge_group) project.project_group_links.create!(group: merge_group)
project.project_group_links.create(group: unprotect_group) project.project_group_links.create!(group: unprotect_group)
protected_branch.push_access_levels.create!(user: push_user) protected_branch.push_access_levels.create!(user: push_user)
protected_branch.merge_access_levels.create!(group: merge_group) protected_branch.merge_access_levels.create!(group: merge_group)
protected_branch.unprotect_access_levels.create!(group: unprotect_group) protected_branch.unprotect_access_levels.create!(group: unprotect_group)
......
...@@ -362,7 +362,7 @@ RSpec.describe API::Scim do ...@@ -362,7 +362,7 @@ RSpec.describe API::Scim do
let_it_be(:params) { { Operations: [{ 'op': 'Replace', 'path': 'active', 'value': 'true' }] }.to_query } let_it_be(:params) { { Operations: [{ 'op': 'Replace', 'path': 'active', 'value': 'true' }] }.to_query }
it 'activates the scim_identity' do it 'activates the scim_identity' do
identity.update(active: false) identity.update!(active: false)
call_patch_api(params) call_patch_api(params)
......
...@@ -106,7 +106,7 @@ RSpec.describe API::Todos do ...@@ -106,7 +106,7 @@ RSpec.describe API::Todos do
end end
it 'returns an error if the epic is not accessible' do it 'returns an error if the epic is not accessible' do
group.update(visibility_level: Gitlab::VisibilityLevel::PRIVATE) group.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
subject subject
......
...@@ -178,7 +178,7 @@ RSpec.describe 'Git LFS API and storage' do ...@@ -178,7 +178,7 @@ RSpec.describe 'Git LFS API and storage' do
let(:authorization) { authorize_deploy_key } let(:authorization) { authorize_deploy_key }
before do before do
project.deploy_keys_projects.create(deploy_key: key, can_push: true) project.deploy_keys_projects.create!(deploy_key: key, can_push: true)
end end
it_behaves_like 'pushes new LFS objects' it_behaves_like 'pushes new LFS objects'
......
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