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: d2040a0d334386e2da961b740ee85893b1c3ec29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ProtectedBranchPolicy, feature_category: :source_code_management 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) }

  context 'as a maintainer' do
    before do
      project.add_maintainer(user)
    end

    it_behaves_like 'allows protected branch crud'
  end

  context 'as a developer' do
    before do
      project.add_developer(user)
    end

    it_behaves_like 'disallows protected branch crud'
  end

  context 'as a guest' do
    before do
      project.add_guest(user)
    end

    it_behaves_like 'disallows protected branch crud'
  end
end