Commit f0f78bb0 authored by Douwe Maan's avatar Douwe Maan Committed by Rémy Coutable

Merge branch 'backport-git-access-spec-changes' into 'master'

Backport git access spec changes from EE

https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/645#note_16391185

See merge request !6961
parent 1a2ca168
...@@ -185,6 +185,7 @@ describe Gitlab::GitAccess, lib: true do ...@@ -185,6 +185,7 @@ describe Gitlab::GitAccess, lib: true do
end end
end end
# Run permission checks for a user
def self.run_permission_checks(permissions_matrix) def self.run_permission_checks(permissions_matrix)
permissions_matrix.keys.each do |role| permissions_matrix.keys.each do |role|
describe "#{role} access" do describe "#{role} access" do
...@@ -194,18 +195,17 @@ describe Gitlab::GitAccess, lib: true do ...@@ -194,18 +195,17 @@ describe Gitlab::GitAccess, lib: true do
else else
project.team << [user, role] project.team << [user, role]
end end
end
permissions_matrix[role].each do |action, allowed| permissions_matrix[role].each do |action, allowed|
context action do context action do
subject { access.push_access_check(changes[action]) } subject { access.push_access_check(changes[action]) }
it { expect(subject.allowed?).to allowed ? be_truthy : be_falsey } it { expect(subject.allowed?).to allowed ? be_truthy : be_falsey }
end end
end end
end end
end end
end end
end
permissions_matrix = { permissions_matrix = {
admin: { admin: {
......
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