diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2014-12-26 13:41:04 +0300 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2014-12-26 13:41:04 +0300 |
commit | 84af3ceb9bbcbf171f92d01967670bf079012f23 (patch) | |
tree | 30fe0dda760ea209b82680f9bd9bcd05f8dd99c8 /spec | |
parent | 92eb3974ac28aff7c78f4ca0cbafbad842fc7160 (diff) |
Add spec for developers can push to protected branches.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/git_access_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb index 66e87e57cbc..8561fd89ba7 100644 --- a/spec/lib/gitlab/git_access_spec.rb +++ b/spec/lib/gitlab/git_access_spec.rb @@ -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 |