Welcome to mirror list, hosted at ThFree Co, Russian Federation.

protected_branch_policy_spec.rb « policies « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1587196754dffb16246e362e4bfda0df77a34005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'spec_helper'

describe ProtectedBranchPolicy do
  let(:user) { create(:user) }
  let(:name) { 'feature' }
  let(:protected_branch) { create(:protected_branch, name: name) }
  let(:project) { protected_branch.project }

  subject { described_class.new(user, protected_branch) }

  it 'branches can be updated via project maintainers' do
    project.add_maintainer(user)

    is_expected.to be_allowed(:update_protected_branch)
  end

  it "branches can't be updated by guests" do
    project.add_guest(user)

    is_expected.to be_disallowed(:update_protected_branch)
  end
end