summaryrefslogtreecommitdiff
path: root/spec/models/group_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-28 21:09:15 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-28 21:09:15 +0000
commit8831c2df7fa3f1bb567e284e4b8c0a4f441e74b3 (patch)
tree36b1b430075ff6e63524be14585dbb614e893e8c /spec/models/group_spec.rb
parent1c8fa70f9d0818e2a82089c8643a6e455bca47fd (diff)
downloadgitlab-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.rb10
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)