Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

changed spec reorder_options_spec.rb to fail

Sven R. Kunzebb3790438435
diff --git a/spec/features/custom_fields/reorder_options_spec.rb b/spec/features/custom_fields/reorder_options_spec.rb
index 3329c29648c..d6279535c98 100644
--- a/spec/features/custom_fields/reorder_options_spec.rb
+++ b/spec/features/custom_fields/reorder_options_spec.rb
@@ -1,6 +1,18 @@
require 'spec_helper'
require 'support/pages/custom_fields'
+def get_possible_values(amount)
+ (1..amount).to_a.map { |x| "PREFIX #{x}" }
+end
+
+def get_shuffled_possible_values(amount)
+ get_possible_values(amount).shuffle(random: Random.new(2))
+end
+
+def get_possible_values_reordered(amount)
+ get_possible_values(amount).sort
+end
+
describe 'Reordering custom options of a list custom field', js: true do
let(:user) { create :admin }
let(:cf_page) { Pages::CustomFields.new }
@@ -9,7 +21,7 @@ describe 'Reordering custom options of a list custom field', js: true do
create(
:list_wp_custom_field,
name: "Platform",
- possible_values: %w[Playstation Xbox Nintendo PC Switch Mobile Dreamcast]
+ possible_values: get_shuffled_possible_values(200)
)
end
@@ -19,7 +31,7 @@ describe 'Reordering custom options of a list custom field', js: true do
it 'reorders the items alphabetically when pressed' do
expect(custom_field.custom_options.order(:position).pluck(:value))
- .to eq %w[Playstation Xbox Nintendo PC Switch Mobile Dreamcast]
+ .to eq get_shuffled_possible_values(200)
cf_page.visit!
click_link custom_field.name
@@ -28,6 +40,6 @@ describe 'Reordering custom options of a list custom field', js: true do
cf_page.accept_alert_dialog!
expect(page).to have_selector('.flash.notice', text: I18n.t(:notice_successful_update))
expect(custom_field.custom_options.order(:position).pluck(:value))
- .to eq %w[Dreamcast Mobile Nintendo PC Playstation Switch Xbox]
+ .to eq get_possible_values_reordered(200)
end
end