summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/utils/usage_data_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
commit9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch)
tree70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/lib/gitlab/utils/usage_data_spec.rb
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
downloadgitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/lib/gitlab/utils/usage_data_spec.rb')
-rw-r--r--spec/lib/gitlab/utils/usage_data_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/lib/gitlab/utils/usage_data_spec.rb b/spec/lib/gitlab/utils/usage_data_spec.rb
index 6e1904c43e1..11b2a12f228 100644
--- a/spec/lib/gitlab/utils/usage_data_spec.rb
+++ b/spec/lib/gitlab/utils/usage_data_spec.rb
@@ -187,6 +187,7 @@ RSpec.describe Gitlab::Utils::UsageData do
describe '#histogram' do
let_it_be(:projects) { create_list(:project, 3) }
+
let(:project1) { projects.first }
let(:project2) { projects.second }
let(:project3) { projects.third }
@@ -478,4 +479,22 @@ RSpec.describe Gitlab::Utils::UsageData do
expect { described_class.track_usage_event(unknown_event, value) }.to raise_error(Gitlab::UsageDataCounters::HLLRedisCounter::UnknownEvent)
end
end
+
+ describe 'min/max' do
+ let(:model) { double(:relation) }
+
+ it 'returns min from the model' do
+ allow(model).to receive(:minimum).and_return(2)
+ allow(model).to receive(:name).and_return('sample_min_model')
+
+ expect(described_class.minimum_id(model)).to eq(2)
+ end
+
+ it 'returns max from the model' do
+ allow(model).to receive(:maximum).and_return(100)
+ allow(model).to receive(:name).and_return('sample_max_model')
+
+ expect(described_class.maximum_id(model)).to eq(100)
+ end
+ end
end