diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-28 21:09:15 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-28 21:09:15 +0000 |
commit | 8831c2df7fa3f1bb567e284e4b8c0a4f441e74b3 (patch) | |
tree | 36b1b430075ff6e63524be14585dbb614e893e8c /spec/models/group_spec.rb | |
parent | 1c8fa70f9d0818e2a82089c8643a6e455bca47fd (diff) | |
download | gitlab-ce-8831c2df7fa3f1bb567e284e4b8c0a4f441e74b3.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r-- | spec/models/group_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 3531c695236..b5ed29189fd 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -911,6 +911,16 @@ describe Group do subject { group.ci_variables_for('ref', project) } + it 'memoizes the result by ref', :request_store do + expect(project).to receive(:protected_for?).with('ref').once.and_return(true) + expect(project).to receive(:protected_for?).with('other').once.and_return(false) + + 2.times do + expect(group.ci_variables_for('ref', project)).to contain_exactly(ci_variable, protected_variable) + expect(group.ci_variables_for('other', project)).to contain_exactly(ci_variable) + end + end + shared_examples 'ref is protected' do it 'contains all the variables' do is_expected.to contain_exactly(ci_variable, protected_variable) |