Commit 84af3ceb authored by Marin Jankovski's avatar Marin Jankovski

Add spec for developers can push to protected branches.

parent 92eb3974
......@@ -129,6 +129,13 @@ describe Gitlab::GitAccess do
}
end
def self.updated_permissions_matrix
updated_permissions_matrix = permissions_matrix.dup
updated_permissions_matrix[:developer][:push_protected_branch] = true
updated_permissions_matrix[:developer][:push_all] = true
updated_permissions_matrix
end
permissions_matrix.keys.each do |role|
describe "#{role} access" do
before { protect_feature_branch }
......@@ -143,5 +150,22 @@ describe Gitlab::GitAccess do
end
end
end
context "with enabled developers push to protected branches " do
updated_permissions_matrix.keys.each do |role|
describe "#{role} access" do
before { create(:protected_branch, name: 'feature', developers_can_push: true, project: project) }
before { project.team << [user, role] }
updated_permissions_matrix[role].each do |action, allowed|
context action do
subject { access.push_access_check(user, project, changes[action]) }
it { subject.allowed?.should allowed ? be_true : be_false }
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