summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/merge_request_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 137795dcbc3..bfad1da1e21 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -3701,4 +3701,18 @@ describe MergeRequest do
end
end
end
+
+ describe '#predefined_variables' do
+ let(:merge_request) { create(:merge_request) }
+
+ it 'caches all SQL-sourced data on the first call' do
+ control = ActiveRecord::QueryRecorder.new { merge_request.predefined_variables }.count
+
+ expect(control).to be > 0
+
+ count = ActiveRecord::QueryRecorder.new { merge_request.predefined_variables }.count
+
+ expect(count).to eq(0)
+ end
+ end
end