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:
authorJamie Schembri <jamie@schembri.me>2018-08-01 12:03:14 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-08-01 12:03:14 +0300
commite72388246b0ab9badfd96cc5888b8d4807daeb89 (patch)
tree8c12a210e89ee6060b3aaa4a351f5d18ed95afaa /spec/support
parent7586693e0b3e7f0e0bacdd8da082f901031e1c98 (diff)
Resolve "Allow issue's Internal ID (`iid`) to be set when creating via the API"
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/models/atomic_internal_id_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/support/shared_examples/models/atomic_internal_id_spec.rb b/spec/support/shared_examples/models/atomic_internal_id_spec.rb
index 7ab1041d17c..c659be8f13a 100644
--- a/spec/support/shared_examples/models/atomic_internal_id_spec.rb
+++ b/spec/support/shared_examples/models/atomic_internal_id_spec.rb
@@ -60,6 +60,20 @@ shared_examples_for 'AtomicInternalId' do |validate_presence: true|
expect { subject }.not_to change { instance.public_send(internal_id_attribute) }
end
+
+ context 'when the instance has an internal ID set' do
+ let(:internal_id) { 9001 }
+
+ it 'calls InternalId.update_last_value and sets the `last_value` to that of the instance' do
+ instance.send("#{internal_id_attribute}=", internal_id)
+
+ expect(InternalId)
+ .to receive(:track_greatest)
+ .with(instance, scope_attrs, usage, internal_id, any_args)
+ .and_return(internal_id)
+ subject
+ end
+ end
end
end
end