diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-18 18:09:08 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-18 18:09:08 +0000 |
commit | 7ea5ca0bb5aa9792c514a22d59217dffa3800581 (patch) | |
tree | 753d90cbdb990d5b4889990fe7e8534d030480b3 /spec/models/exported_protected_branch_spec.rb | |
parent | e26bf16ed06dd7fc959961cfe16621c19f0e6acf (diff) | |
download | gitlab-ce-7ea5ca0bb5aa9792c514a22d59217dffa3800581.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/exported_protected_branch_spec.rb')
-rw-r--r-- | spec/models/exported_protected_branch_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/exported_protected_branch_spec.rb b/spec/models/exported_protected_branch_spec.rb new file mode 100644 index 00000000000..7886a522741 --- /dev/null +++ b/spec/models/exported_protected_branch_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ExportedProtectedBranch do + describe 'Associations' do + it { is_expected.to have_many(:push_access_levels) } + end + + describe '.push_access_levels' do + it 'returns the correct push access levels' do + exported_branch = create(:exported_protected_branch, :developers_can_push) + deploy_key = create(:deploy_key) + create(:deploy_keys_project, :write_access, project: exported_branch.project, deploy_key: deploy_key ) + create(:protected_branch_push_access_level, protected_branch: exported_branch, deploy_key: deploy_key) + dev_push_access_level = exported_branch.push_access_levels.first + + expect(exported_branch.push_access_levels).to contain_exactly(dev_push_access_level) + end + end +end |