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

Globally include time helpers

Klaus Zanders77f13d496429
diff --git a/modules/storages/spec/components/storages/admin/sidebar/health_status_component_spec.rb b/modules/storages/spec/components/storages/admin/sidebar/health_status_component_spec.rb
index 7a371df9eaa..5ad2634d581 100644
--- a/modules/storages/spec/components/storages/admin/sidebar/health_status_component_spec.rb
+++ b/modules/storages/spec/components/storages/admin/sidebar/health_status_component_spec.rb
@@ -30,7 +30,6 @@ require "spec_helper"
require_module_spec_helper
RSpec.describe Storages::Admin::Sidebar::HealthStatusComponent, type: :component do
- include ActiveSupport::Testing::TimeHelpers
frozen_date_time = Time.zone.local(2023, 11, 28, 1, 2, 3)
subject(:health_status_component) { described_class.new(storage:) }
diff --git a/spec/features/activities/activity_page_navigation_spec.rb b/spec/features/activities/activity_page_navigation_spec.rb
index 90242e5337e..d2ec1bdfd0e 100644
--- a/spec/features/activities/activity_page_navigation_spec.rb
+++ b/spec/features/activities/activity_page_navigation_spec.rb
@@ -29,8 +29,6 @@
require "spec_helper"
RSpec.describe "Activity page navigation", :js, :with_cuprite do
- include ActiveSupport::Testing::TimeHelpers
-
shared_let(:project) { create(:project, enabled_module_names: Setting.default_projects_modules + ["activity"]) }
shared_let(:subproject) do
create(:project, parent: project, enabled_module_names: Setting.default_projects_modules + ["activity"])
diff --git a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
index dc8b6fb49e3..1a715001f3a 100644
--- a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
@@ -4,8 +4,6 @@ require "features/page_objects/notification"
# rubocop:disable RSpec/ScatteredLet
RSpec.describe "Notification center date alerts", :js, :with_cuprite,
with_settings: { journal_aggregation_time_minutes: 0 } do
- include ActiveSupport::Testing::TimeHelpers
-
# Find an assignable time zone with the same UTC offset as the local time zone
def find_compatible_local_time_zone
local_offset = Time.now.gmt_offset # rubocop:disable Rails/TimeZone
diff --git a/spec/features/projects/projects_index_spec.rb b/spec/features/projects/projects_index_spec.rb
index 54b13a72b9b..578bc6756f8 100644
--- a/spec/features/projects/projects_index_spec.rb
+++ b/spec/features/projects/projects_index_spec.rb
@@ -625,8 +625,6 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { login
end
describe "other filter types", with_ee: %i[custom_fields_in_projects_list] do
- include ActiveSupport::Testing::TimeHelpers
-
shared_let(:list_custom_field) { create(:list_project_custom_field) }
shared_let(:date_custom_field) { create(:date_project_custom_field) }
shared_let(:datetime_of_this_week) do
diff --git a/spec/support/time_helpers.rb b/spec/support/time_helpers.rb
index df92727ee96..3dbe35475a7 100644
--- a/spec/support/time_helpers.rb
+++ b/spec/support/time_helpers.rb
@@ -25,6 +25,11 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
+
+RSpec.configure do |config|
+ config.include ActiveSupport::Testing::TimeHelpers
+end
+
RSpec::Matchers.define :equal_time_without_usec do |expected|
failure_message { "expected: #{expected.iso8601}, actual: #{actual.iso8601}, difference: #{actual - expected}s" }
diff --git a/spec/support_spec/schedule_helpers/chart_builder_spec.rb b/spec/support_spec/schedule_helpers/chart_builder_spec.rb
index b73a33dbb0e..71180075b1e 100644
--- a/spec/support_spec/schedule_helpers/chart_builder_spec.rb
+++ b/spec/support_spec/schedule_helpers/chart_builder_spec.rb
@@ -29,8 +29,6 @@
require "spec_helper"
RSpec.describe ScheduleHelpers::ChartBuilder do
- include ActiveSupport::Testing::TimeHelpers
-
let(:fake_today) { Date.new(2022, 6, 16) } # Thursday 16 June 2022
let(:monday) { Date.new(2022, 6, 20) } # Monday 20 June
let(:tuesday) { Date.new(2022, 6, 21) }
diff --git a/spec/support_spec/schedule_helpers/chart_spec.rb b/spec/support_spec/schedule_helpers/chart_spec.rb
index 3873d26f671..1f06dbfd951 100644
--- a/spec/support_spec/schedule_helpers/chart_spec.rb
+++ b/spec/support_spec/schedule_helpers/chart_spec.rb
@@ -29,8 +29,6 @@
require "spec_helper"
RSpec.describe ScheduleHelpers::Chart do
- include ActiveSupport::Testing::TimeHelpers
-
let(:fake_today) { Date.new(2022, 6, 16) } # Thursday 16 June 2022
let(:monday) { Date.new(2022, 6, 20) } # Monday 20 June
let(:tuesday) { Date.new(2022, 6, 21) }
diff --git a/spec/support_spec/schedule_helpers/example_methods_spec.rb b/spec/support_spec/schedule_helpers/example_methods_spec.rb
index cb01a9bcb09..924c18edce2 100644
--- a/spec/support_spec/schedule_helpers/example_methods_spec.rb
+++ b/spec/support_spec/schedule_helpers/example_methods_spec.rb
@@ -105,8 +105,6 @@ RSpec.describe ScheduleHelpers::ExampleMethods do
end
describe "change_schedule" do
- include ActiveSupport::Testing::TimeHelpers
-
let(:fake_today) { Date.new(2022, 6, 16) } # Thursday 16 June 2022
let(:monday) { Date.new(2022, 6, 20) } # Monday 20 June
let(:tuesday) { Date.new(2022, 6, 21) }
diff --git a/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb b/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb
index 00a1a319973..3e7abe37998 100644
--- a/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb
+++ b/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb
@@ -29,8 +29,6 @@
require "spec_helper"
RSpec.describe Notifications::CreateDateAlertsNotificationsJob, type: :job, with_ee: %i[date_alerts] do
- include ActiveSupport::Testing::TimeHelpers
-
shared_let(:project) { create(:project, name: "main") }
shared_let(:status_open) { create(:status, name: "open", is_closed: false) }
diff --git a/spec/workers/notifications/schedule_date_alerts_notifications_job_spec.rb b/spec/workers/notifications/schedule_date_alerts_notifications_job_spec.rb
index 3f2fd8a5bb3..bfcdbea65f5 100644
--- a/spec/workers/notifications/schedule_date_alerts_notifications_job_spec.rb
+++ b/spec/workers/notifications/schedule_date_alerts_notifications_job_spec.rb
@@ -29,8 +29,6 @@
require "spec_helper"
RSpec.describe Notifications::ScheduleDateAlertsNotificationsJob, type: :job, with_ee: %i[date_alerts] do
- include ActiveSupport::Testing::TimeHelpers
-
shared_let(:project) { create(:project, name: "main") }
# Paris and Berlin are both UTC+01:00 (CET) or UTC+02:00 (CEST)
shared_let(:timezone_paris) { ActiveSupport::TimeZone["Europe/Paris"] }