Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/database/batch_count_spec.rb')
-rw-r--r--spec/lib/gitlab/database/batch_count_spec.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/spec/lib/gitlab/database/batch_count_spec.rb b/spec/lib/gitlab/database/batch_count_spec.rb
index 7842323d009..7be84b8f980 100644
--- a/spec/lib/gitlab/database/batch_count_spec.rb
+++ b/spec/lib/gitlab/database/batch_count_spec.rb
@@ -86,10 +86,6 @@ describe Gitlab::Database::BatchCount do
end
describe '#batch_distinct_count' do
- it 'counts with :id field' do
- expect(described_class.batch_distinct_count(model, :id)).to eq(5)
- end
-
it 'counts with column field' do
expect(described_class.batch_distinct_count(model, column)).to eq(2)
end
@@ -137,6 +133,12 @@ describe Gitlab::Database::BatchCount do
it 'returns fallback if batch size is less than min required' do
expect(described_class.batch_distinct_count(model, column, batch_size: small_batch_size)).to eq(fallback)
end
+
+ it 'will raise an error if distinct count with the :id column is requested' do
+ expect do
+ described_class.batch_count(described_class.batch_distinct_count(model, :id))
+ end.to raise_error 'Use distinct count only with non id fields'
+ end
end
end
end