summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKerri Miller <kerrizor@kerrizor.com>2019-08-07 15:13:13 +0000
committerDouwe Maan <douwe@gitlab.com>2019-08-07 15:13:13 +0000
commit336d3ccc65d522633162b1f6b5fc54591c588221 (patch)
tree7dfea148c6e69f40e8f2a20b6dda683be4c617cc /spec
parent35e49d3be0ffe58fef80c30f6b432312541b8a73 (diff)
downloadgitlab-ce-336d3ccc65d522633162b1f6b5fc54591c588221.tar.gz
Initial commit of WIP code for consideration
Squash this commit and reword before merging..
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/banzai/filter/commit_reference_filter_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/commit_reference_filter_spec.rb b/spec/lib/banzai/filter/commit_reference_filter_spec.rb
index 1bc0335cfc0..326703eea05 100644
--- a/spec/lib/banzai/filter/commit_reference_filter_spec.rb
+++ b/spec/lib/banzai/filter/commit_reference_filter_spec.rb
@@ -105,6 +105,17 @@ describe Banzai::Filter::CommitReferenceFilter do
expect(doc.css('a').first[:href]).to eq(url)
end
+
+ context "a doc with many (29) strings that could be SHAs" do
+ let!(:oids) { noteable.commits.collect(&:id) }
+
+ it 'makes only a single request to Gitaly' do
+ expect(Gitlab::GitalyClient).to receive(:allow_n_plus_1_calls).exactly(0).times
+ expect(Gitlab::Git::Commit).to receive(:batch_by_oid).once.and_call_original
+
+ reference_filter("A big list of SHAs #{oids.join(", ")}", noteable: noteable)
+ end
+ end
end
end