summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/models/boards/listable_shared_examples.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/support/shared_examples/models/boards/listable_shared_examples.rb
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
downloadgitlab-ce-d01dcc7e6779d5b18a2967c572865b84f63f16aa.tar.gz
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/support/shared_examples/models/boards/listable_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/models/boards/listable_shared_examples.rb25
1 files changed, 15 insertions, 10 deletions
diff --git a/spec/support/shared_examples/models/boards/listable_shared_examples.rb b/spec/support/shared_examples/models/boards/listable_shared_examples.rb
index e733a5488fb..250a4c1b1bd 100644
--- a/spec/support/shared_examples/models/boards/listable_shared_examples.rb
+++ b/spec/support/shared_examples/models/boards/listable_shared_examples.rb
@@ -16,18 +16,23 @@ RSpec.shared_examples 'boards listable model' do |list_factory|
end
describe 'scopes' do
+ let_it_be(:list1) { create(list_factory, list_type: :backlog) }
+ let_it_be(:list2) { create(list_factory, list_type: :closed) }
+ let_it_be(:list3) { create(list_factory, position: 1) }
+ let_it_be(:list4) { create(list_factory, position: 2) }
+
describe '.ordered' do
it 'returns lists ordered by type and position' do
- # rubocop:disable Rails/SaveBang
- lists = [
- create(list_factory, list_type: :backlog),
- create(list_factory, list_type: :closed),
- create(list_factory, position: 1),
- create(list_factory, position: 2)
- ]
- # rubocop:enable Rails/SaveBang
-
- expect(described_class.where(id: lists).ordered).to eq([lists[0], lists[2], lists[3], lists[1]])
+ expect(described_class.where(id: [list1, list2, list3, list4]).ordered)
+ .to eq([list1, list3, list4, list2])
+ end
+ end
+
+ describe '.without_types' do
+ it 'excludes lists of given types' do
+ lists = described_class.without_types([:label, :closed])
+
+ expect(lists).to match_array([list1])
end
end
end