diff options
author | Kamil TrzciĆski <kamil@gitlab.com> | 2018-01-26 17:05:04 +0000 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-02-09 12:16:29 -0600 |
commit | 02f93da8600a77e1502e89c3a65513a806c0d847 (patch) | |
tree | b89592dbcde57b79b15f592cdcc04d5c57057620 /spec/models/project_spec.rb | |
parent | 68e31c098ec3984c42b921c07fec8593116e77ce (diff) | |
download | gitlab-ce-02f93da8600a77e1502e89c3a65513a806c0d847.tar.gz |
Merge branch 'mc/bug/38984-wildcard-protected-tags' into 'security-10-4'
Fix using wildcards in protected tags to expose protected variables
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r-- | spec/models/project_spec.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 50b8bb7acb3..ee04d74d848 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -2092,7 +2092,7 @@ describe Project do context 'when the ref is a protected branch' do before do - create(:protected_branch, name: 'ref', project: project) + allow(project).to receive(:protected_for?).with('ref').and_return(true) end it_behaves_like 'ref is protected' @@ -2100,7 +2100,7 @@ describe Project do context 'when the ref is a protected tag' do before do - create(:protected_tag, name: 'ref', project: project) + allow(project).to receive(:protected_for?).with('ref').and_return(true) end it_behaves_like 'ref is protected' @@ -2125,6 +2125,8 @@ describe Project do context 'when the ref is a protected branch' do before do + allow(project).to receive(:repository).and_call_original + allow(project).to receive_message_chain(:repository, :branch_exists?).and_return(true) create(:protected_branch, name: 'ref', project: project) end @@ -2135,6 +2137,8 @@ describe Project do context 'when the ref is a protected tag' do before do + allow(project).to receive_message_chain(:repository, :branch_exists?).and_return(false) + allow(project).to receive_message_chain(:repository, :tag_exists?).and_return(true) create(:protected_tag, name: 'ref', project: project) end |