Add spec for developers can push to protected branches.

This commit is contained in:
Marin Jankovski 2014-12-26 11:41:04 +01:00
parent 92eb3974ac
commit 84af3ceb9b

View file

@ -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