Commit b217fd6c authored by Aleksei Lipniagov's avatar Aleksei Lipniagov

Merge branch 'issue_220040_2' into 'master'

Fix Rails/SaveBang offenses for `ee/spec/lib/ee/gitlab`

See merge request gitlab-org/gitlab!75925
parents 20d55baf abe38ad3
...@@ -3,9 +3,6 @@ Rails/SaveBang: ...@@ -3,9 +3,6 @@ Rails/SaveBang:
Exclude: Exclude:
- 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/checks/push_rules/commit_check_spec.rb
- ee/spec/lib/ee/gitlab/ci/pipeline/quota/activity_spec.rb
- ee/spec/lib/gitlab/auth/ldap/access_spec.rb - ee/spec/lib/gitlab/auth/ldap/access_spec.rb
- ee/spec/lib/gitlab/auth/o_auth/user_spec.rb - ee/spec/lib/gitlab/auth/o_auth/user_spec.rb
- ee/spec/lib/gitlab/auth/saml/user_spec.rb - ee/spec/lib/gitlab/auth/saml/user_spec.rb
......
...@@ -203,7 +203,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -203,7 +203,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
it 'converts an existing membership access request to a real member' do it 'converts an existing membership access request to a real member' do
group.add_owner(create(:user)) group.add_owner(create(:user))
access_requester = group.request_access(user) access_requester = group.request_access(user)
access_requester.update(access_level: ::Gitlab::Access::MAINTAINER) access_requester.update!(access_level: ::Gitlab::Access::MAINTAINER)
# Validate that the user is properly created as a requester first. # Validate that the user is properly created as a requester first.
expect(group.requesters.pluck(:id)).to include(access_requester.id) expect(group.requesters.pluck(:id)).to include(access_requester.id)
...@@ -246,7 +246,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -246,7 +246,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
end end
it 'does not alter an ldap member that has a permission override' do it 'does not alter an ldap member that has a permission override' do
group.members.create( group.members.create!(
user: user, user: user,
access_level: ::Gitlab::Access::MAINTAINER, access_level: ::Gitlab::Access::MAINTAINER,
ldap: true, ldap: true,
...@@ -316,7 +316,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -316,7 +316,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) } let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) }
before do before do
group.update(parent: parent_group) group.update!(parent: parent_group)
parent_group.add_maintainer(user) parent_group.add_maintainer(user)
end end
...@@ -337,7 +337,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -337,7 +337,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
end end
it "does not alter an ldap member that has a permission override" do it "does not alter an ldap member that has a permission override" do
group.members.create( group.members.create!(
user: user, user: user,
access_level: ::Gitlab::Access::OWNER, access_level: ::Gitlab::Access::OWNER,
ldap: true, ldap: true,
...@@ -356,7 +356,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -356,7 +356,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) } let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) }
before do before do
group.update(parent: parent_group) group.update!(parent: parent_group)
parent_group.add_reporter(user) parent_group.add_reporter(user)
end end
...@@ -377,7 +377,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -377,7 +377,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
end end
it "does not alter an ldap member that has a permission override" do it "does not alter an ldap member that has a permission override" do
group.members.create( group.members.create!(
user: user, user: user,
access_level: ::Gitlab::Access::OWNER, access_level: ::Gitlab::Access::OWNER,
ldap: true, ldap: true,
...@@ -397,17 +397,17 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -397,17 +397,17 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
let(:access_requester) { parent_group.request_access(user) } let(:access_requester) { parent_group.request_access(user) }
before do before do
group.update(parent: parent_group) group.update!(parent: parent_group)
parent_group.add_owner(create(:user)) parent_group.add_owner(create(:user))
end end
it 'does not propagate the access level of the pending access request' do it 'does not propagate the access level of the pending access request' do
group.members.create( group.members.create!(
user: user, user: user,
access_level: ::Gitlab::Access::DEVELOPER, access_level: ::Gitlab::Access::DEVELOPER,
ldap: true ldap: true
) )
access_requester.update(access_level: ::Gitlab::Access::MAINTAINER) access_requester.update!(access_level: ::Gitlab::Access::MAINTAINER)
sync_group.update_permissions sync_group.update_permissions
...@@ -423,7 +423,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -423,7 +423,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
let(:ldap_group1) { ldap_group_entry(user_dn('other_user')) } let(:ldap_group1) { ldap_group_entry(user_dn('other_user')) }
before do before do
group.update(parent: parent_group) group.update!(parent: parent_group)
parent_group.add_maintainer(user) parent_group.add_maintainer(user)
end end
...@@ -445,13 +445,13 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -445,13 +445,13 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
before do before do
group1.add_reporter(user) group1.add_reporter(user)
group2.update(parent: group1) group2.update!(parent: group1)
group2.add_maintainer(user) group2.add_maintainer(user)
group3.update(parent: group2) group3.update!(parent: group2)
# no specific permission for user in group3 # no specific permission for user in group3
group.update(parent: group3) group.update!(parent: group3)
end end
it "applies the permission inherited from the closest ancestor when it's higher" do it "applies the permission inherited from the closest ancestor when it's higher" do
...@@ -478,13 +478,13 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -478,13 +478,13 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
it 'does not revert the overrides' do it 'does not revert the overrides' do
create(:identity, user: user1, extern_uid: user_dn(user1.username)) create(:identity, user: user1, extern_uid: user_dn(user1.username))
create(:identity, user: user2, extern_uid: user_dn(user2.username).upcase) create(:identity, user: user2, extern_uid: user_dn(user2.username).upcase)
group.members.create( group.members.create!(
user: user1, user: user1,
access_level: ::Gitlab::Access::MAINTAINER, access_level: ::Gitlab::Access::MAINTAINER,
ldap: true, ldap: true,
override: true override: true
) )
group.members.create( group.members.create!(
user: user2, user: user2,
access_level: ::Gitlab::Access::OWNER, access_level: ::Gitlab::Access::OWNER,
ldap: true, ldap: true,
......
...@@ -205,14 +205,14 @@ RSpec.describe EE::Gitlab::Checks::PushRules::CommitCheck do ...@@ -205,14 +205,14 @@ RSpec.describe EE::Gitlab::Checks::PushRules::CommitCheck do
end end
it 'allows the commit when they were done with another email that belongs to the current user' do it 'allows the commit when they were done with another email that belongs to the current user' do
user.emails.create(email: 'secondary_email@user.com', confirmed_at: Time.now) user.emails.create!(email: 'secondary_email@user.com', confirmed_at: Time.now)
allow_any_instance_of(Commit).to receive(:committer_email).and_return('secondary_email@user.com') allow_any_instance_of(Commit).to receive(:committer_email).and_return('secondary_email@user.com')
expect { subject.validate! }.not_to raise_error expect { subject.validate! }.not_to raise_error
end end
it 'raises an error when the commit was done with an unverified email' do it 'raises an error when the commit was done with an unverified email' do
user.emails.create(email: 'secondary_email@user.com') user.emails.create!(email: 'secondary_email@user.com')
allow_any_instance_of(Commit).to receive(:committer_email).and_return('secondary_email@user.com') allow_any_instance_of(Commit).to receive(:committer_email).and_return('secondary_email@user.com')
expect { subject.validate! } expect { subject.validate! }
......
...@@ -18,7 +18,7 @@ RSpec.describe EE::Gitlab::Ci::Pipeline::Quota::Activity, :saas do ...@@ -18,7 +18,7 @@ RSpec.describe EE::Gitlab::Ci::Pipeline::Quota::Activity, :saas do
create(:ci_pipeline, project: project, status: 'pending') create(:ci_pipeline, project: project, status: 'pending')
create(:ci_pipeline, project: project, status: 'running') create(:ci_pipeline, project: project, status: 'running')
plan_limits.update(ci_active_pipelines: 1) plan_limits.update!(ci_active_pipelines: 1)
end end
end end
......
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