Commit 6cbf3079 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-git-access-specs-ee' into 'master'

Fit GitAccess specs

See merge request !1297
parents 9db16962 dacf2225
...@@ -215,7 +215,9 @@ describe Gitlab::GitAccess, lib: true do ...@@ -215,7 +215,9 @@ describe Gitlab::GitAccess, lib: true do
def stub_git_hooks def stub_git_hooks
# Running the `pre-receive` hook is expensive, and not necessary for this test. # Running the `pre-receive` hook is expensive, and not necessary for this test.
allow_any_instance_of(GitHooksService).to receive(:execute).and_yield(GitHooksService.new) allow_any_instance_of(GitHooksService).to receive(:execute) do |service, &block|
block.call(service)
end
end end
def merge_into_protected_branch def merge_into_protected_branch
...@@ -242,17 +244,17 @@ describe Gitlab::GitAccess, lib: true do ...@@ -242,17 +244,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.send(:check_push_access!, changes[action]) } subject { access.send(:check_push_access!, changes[action]) }
it do it do
if allowed if allowed
expect { subject }.not_to raise_error expect { subject }.not_to raise_error
else else
expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError) expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError)
end
end end
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