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:
authorAndreas Brandl <abrandl@gitlab.com>2018-03-16 15:34:08 +0300
committerAndreas Brandl <abrandl@gitlab.com>2018-03-16 15:35:27 +0300
commitfb6d6fce5a4d0fd833dc1cd231dd284a6c89471a (patch)
treecd60653ee507ae673a6da8a12ebd731bf449f525 /spec/models/internal_id_spec.rb
parentbc3fc8ec3eec74876a0e2125248c27cde153e32b (diff)
Address review comments.
Diffstat (limited to 'spec/models/internal_id_spec.rb')
-rw-r--r--spec/models/internal_id_spec.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/spec/models/internal_id_spec.rb b/spec/models/internal_id_spec.rb
index ef6db2daa95..40d777c46cc 100644
--- a/spec/models/internal_id_spec.rb
+++ b/spec/models/internal_id_spec.rb
@@ -41,10 +41,11 @@ describe InternalId do
end
it 'generates a strictly monotone, gapless sequence' do
- seq = (0..rand(1000)).map do
+ seq = (0..rand(100)).map do
described_class.generate_next(issue, scope, usage, init)
end
normalized = seq.map { |i| i - seq.min }
+
expect(normalized).to eq((0..seq.size - 1).to_a)
end
@@ -58,6 +59,7 @@ describe InternalId do
it 'calculates next internal ids on the fly' do
val = rand(1..100)
+
expect(init).to receive(:call).with(issue).and_return(val)
expect(subject).to eq(val + 1)
end
@@ -70,11 +72,13 @@ describe InternalId do
it 'returns incremented iid' do
value = id.last_value
+
expect(subject).to eq(value + 1)
end
it 'saves the record' do
subject
+
expect(id.changed?).to be_falsey
end