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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
refacotr: Reduce duplication and dead-code
Christophe Bliard07e707033e95
diff --git a/spec/features/admin/working_days_spec.rb b/spec/features/admin/working_days_spec.rbindex 2ea8a1af623..c87110ffcee 100644--- a/spec/features/admin/working_days_spec.rb+++ b/spec/features/admin/working_days_spec.rb@@ -187,7 +187,6 @@ RSpec.describe "Working Days", :js, :with_cuprite doendit "can add non-working days" do- # Initial loading can sometimes take a whiledatepicker.open_modal!# Check if a date is correctly highlighted after selecting it in different time zonesdiff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rbindex 96de5d5d1a9..9fc2c1c5413 100644--- a/spec/support/components/datepicker/datepicker.rb+++ b/spec/support/components/datepicker/datepicker.rb@@ -85,6 +85,11 @@ module Components.first(".flatpickr-days .flatpickr-day:not(.nextMonthDay):not(.prevMonthDay)",text: value).click++ # safeguard+ unless flatpickr_container.has_css?(".flatpickr-day.selected", text: value, wait: 1)+ raise "Expected #{value} to be selected"+ endendenddiff --git a/spec/support/components/datepicker/datepicker_modal.rb b/spec/support/components/datepicker/datepicker_modal.rbindex 2af089c8649..8d20e10ea40 100644--- a/spec/support/components/datepicker/datepicker_modal.rb+++ b/spec/support/components/datepicker/datepicker_modal.rb@@ -1,13 +1,8 @@module Componentsclass DatepickerModal < Datepickerdef open_modal!- retry_block do- click_on "Non-working day", wait: 10- unless page.has_css?(".flatpickr-calendar", wait: 10)- click_on "Cancel"- raise "Flatpickr should render a calendar"- end- end+ click_on "Non-working day"+ expect_visibleenddef set_date_input(date)@@ -17,24 +12,5 @@ module Componentsraise "Expected date to equal #{date}, but got #{input.value}" unless input.value == date.iso8601endend-- ##- # Select day from datepicker- def select_day(value)- unless (1..31).cover?(value.to_i)- raise ArgumentError, "Invalid value #{value} for day, expected 1-31"- end-- expect(flatpickr_container).to have_text(value)-- retry_block do- flatpickr_container- .first(".flatpickr-days .flatpickr-day:not(.nextMonthDay):not(.prevMonthDay)",- text: value)- .click-- raise "Expected #{value} to be selected" unless flatpickr_container.has_css?(".flatpickr-day.selected", text: value)- end- endendend