From 25ac126df95a83cede16d4f30b39c37b46b7f215 Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Sat, 7 Dec 2024 16:05:07 +0100 Subject: [PATCH] Systematize core extesions --- config/initializers/core_ext.rb | 6 +++++- config/initializers/system_test_case.rb | 3 --- ...t_helper_unique_id.rb => screenshot_helper_unique_id.rb} | 2 +- .../formatting.rb => big_decimal_scientific_notation.rb} | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) delete mode 100644 config/initializers/system_test_case.rb rename lib/core_ext/action_dispatch/system_testing/test_helpers/{custom_screenshot_helper_unique_id.rb => screenshot_helper_unique_id.rb} (52%) rename lib/core_ext/{big_decimal/formatting.rb => big_decimal_scientific_notation.rb} (92%) diff --git a/config/initializers/core_ext.rb b/config/initializers/core_ext.rb index 5feeadb..54a1409 100644 --- a/config/initializers/core_ext.rb +++ b/config/initializers/core_ext.rb @@ -1 +1,5 @@ -require 'core_ext/big_decimal/formatting' +require 'core_ext/big_decimal_scientific_notation' + +ActiveSupport.on_load :action_dispatch_system_test_case do + prepend CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelperUniqueId +end diff --git a/config/initializers/system_test_case.rb b/config/initializers/system_test_case.rb deleted file mode 100644 index 9e3ef71..0000000 --- a/config/initializers/system_test_case.rb +++ /dev/null @@ -1,3 +0,0 @@ -ActiveSupport.on_load :action_dispatch_system_test_case do - prepend CoreExt::ActionDispatch::SystemTesting::TestHelpers::CustomScreenshotHelperUniqueId -end diff --git a/lib/core_ext/action_dispatch/system_testing/test_helpers/custom_screenshot_helper_unique_id.rb b/lib/core_ext/action_dispatch/system_testing/test_helpers/screenshot_helper_unique_id.rb similarity index 52% rename from lib/core_ext/action_dispatch/system_testing/test_helpers/custom_screenshot_helper_unique_id.rb rename to lib/core_ext/action_dispatch/system_testing/test_helpers/screenshot_helper_unique_id.rb index 3798c38..248a6fd 100644 --- a/lib/core_ext/action_dispatch/system_testing/test_helpers/custom_screenshot_helper_unique_id.rb +++ b/lib/core_ext/action_dispatch/system_testing/test_helpers/screenshot_helper_unique_id.rb @@ -1,4 +1,4 @@ -module CoreExt::ActionDispatch::SystemTesting::TestHelpers::CustomScreenshotHelperUniqueId +module CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelperUniqueId private def unique diff --git a/lib/core_ext/big_decimal/formatting.rb b/lib/core_ext/big_decimal_scientific_notation.rb similarity index 92% rename from lib/core_ext/big_decimal/formatting.rb rename to lib/core_ext/big_decimal_scientific_notation.rb index 8418326..0a45c90 100644 --- a/lib/core_ext/big_decimal/formatting.rb +++ b/lib/core_ext/big_decimal_scientific_notation.rb @@ -1,4 +1,4 @@ -module FixinMe +module CoreExt module BigDecimalScientificNotation def to_scientific return 'NaN' unless finite? @@ -33,4 +33,4 @@ module FixinMe end end -BigDecimal.prepend(FixinMe::BigDecimalScientificNotation) +BigDecimal.prepend CoreExt::BigDecimalScientificNotation