From 7e9c479f7de77702622631cff2628a9c8dcbc627 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 Nov 2020 08:27:35 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-6-stable-ee --- spec/models/concerns/atomic_internal_id_spec.rb | 16 ++++++++++++++++ spec/models/concerns/from_union_spec.rb | 10 +--------- spec/models/concerns/optionally_search_spec.rb | 2 +- 3 files changed, 18 insertions(+), 10 deletions(-) (limited to 'spec/models/concerns') diff --git a/spec/models/concerns/atomic_internal_id_spec.rb b/spec/models/concerns/atomic_internal_id_spec.rb index 8c3537f1dcc..5ee3c012dc9 100644 --- a/spec/models/concerns/atomic_internal_id_spec.rb +++ b/spec/models/concerns/atomic_internal_id_spec.rb @@ -86,4 +86,20 @@ RSpec.describe AtomicInternalId do expect { subject }.to change { milestone.iid }.from(nil).to(iid.to_i) end end + + describe '.with_project_iid_supply' do + let(:iid) { 100 } + + it 'wraps generate and track_greatest in a concurrency-safe lock' do + expect_next_instance_of(InternalId::InternalIdGenerator) do |g| + expect(g).to receive(:with_lock).and_call_original + expect(g.record).to receive(:last_value).and_return(iid) + expect(g).to receive(:track_greatest).with(iid + 4) + end + + ::Milestone.with_project_iid_supply(milestone.project) do |supply| + 4.times { supply.next_value } + end + end + end end diff --git a/spec/models/concerns/from_union_spec.rb b/spec/models/concerns/from_union_spec.rb index bd2893090a8..4f4d948fe48 100644 --- a/spec/models/concerns/from_union_spec.rb +++ b/spec/models/concerns/from_union_spec.rb @@ -3,13 +3,5 @@ require 'spec_helper' RSpec.describe FromUnion do - [true, false].each do |sql_set_operator| - context "when sql-set-operators feature flag is #{sql_set_operator}" do - before do - stub_feature_flags(sql_set_operators: sql_set_operator) - end - - it_behaves_like 'from set operator', Gitlab::SQL::Union - end - end + it_behaves_like 'from set operator', Gitlab::SQL::Union end diff --git a/spec/models/concerns/optionally_search_spec.rb b/spec/models/concerns/optionally_search_spec.rb index c8e2e6da51f..8067ad50322 100644 --- a/spec/models/concerns/optionally_search_spec.rb +++ b/spec/models/concerns/optionally_search_spec.rb @@ -32,7 +32,7 @@ RSpec.describe OptionallySearch do it 'delegates to the search method' do expect(model) .to receive(:search) - .with('foo', {}) + .with('foo') .and_call_original expect(model.optionally_search('foo')).to eq(['foo', {}]) -- cgit v1.2.1