summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2019-08-01 17:59:16 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2019-08-01 18:11:20 +0200
commite3dd1adafa4d2bc27081184ed98f961a08c38268 (patch)
tree6eea35b6a9932c8a343f1000e46006886986f666
parent536ebecf7eec95bd2cc1b542f1c35d70f814731e (diff)
downloadgitlab-ce-e3dd1adafa4d2bc27081184ed98f961a08c38268.tar.gz
Skip specs for default relative positions
If a model has a default relative position we don't need to test that it is moved to the end, it will instead get the default value assigned.
-rw-r--r--spec/support/shared_examples/relative_positioning_shared_examples.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/support/shared_examples/relative_positioning_shared_examples.rb b/spec/support/shared_examples/relative_positioning_shared_examples.rb
index 45eacf3721e..1c53e2602eb 100644
--- a/spec/support/shared_examples/relative_positioning_shared_examples.rb
+++ b/spec/support/shared_examples/relative_positioning_shared_examples.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.shared_examples "a class that supports relative positioning" do
+RSpec.shared_examples 'a class that supports relative positioning' do
let(:item1) { create(factory, default_params) }
let(:item2) { create(factory, default_params) }
let(:new_item) { create(factory, default_params) }
@@ -11,6 +11,9 @@ RSpec.shared_examples "a class that supports relative positioning" do
describe '.move_nulls_to_end' do
it 'moves items with null relative_position to the end' do
+ skip("#{item1} has a default relative position") if item1.relative_position
+ skip("#{item2} has a default relative position") if item2.relative_position
+
described_class.move_nulls_to_end([item1, item2])
expect(item2.prev_relative_position).to eq item1.relative_position
@@ -19,6 +22,8 @@ RSpec.shared_examples "a class that supports relative positioning" do
end
it 'moves the item near the start position when there are no existing positions' do
+ skip("#{item1} has a default relative position") if item1.relative_position
+
described_class.move_nulls_to_end([item1])
expect(item1.relative_position).to eq(described_class::START_POSITION + described_class::IDEAL_DISTANCE)