forked from fixin.me/fixin.me
Shorten core extensions module names
This commit is contained in:
@@ -3,24 +3,31 @@ require 'core_ext/float'
|
||||
require 'core_ext/range'
|
||||
|
||||
ActiveSupport.on_load :action_dispatch_system_test_case do
|
||||
prepend CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelperUniqueId
|
||||
# Allow denormalized string comparison,
|
||||
# https://github.com/orgs/teamcapybara/discussions/2841
|
||||
XPath::DSL.prepend CoreExt::XPath::DSL::NormalizeSpaceDefault
|
||||
# Add timestamp to screenshot filenames to make them unique.
|
||||
prepend CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper
|
||||
|
||||
# Allow denormalized string comparison:
|
||||
# * https://github.com/orgs/teamcapybara/discussions/2841
|
||||
XPath::DSL.prepend CoreExt::XPath::DSL
|
||||
end
|
||||
|
||||
ActiveSupport.on_load :active_record do
|
||||
# Validate that number fits into Float data type.
|
||||
ActiveModel::Validations::NumericalityValidator
|
||||
.prepend CoreExt::ActiveModel::Validations::NumericalityValidatesPrecision
|
||||
.prepend CoreExt::ActiveModel::Validations::NumericalityValidator
|
||||
|
||||
# Temporary patch for https://github.com/rails/rails/pull/54658
|
||||
# Temporary patch for https://github.com/rails/rails/pull/54658.
|
||||
ActiveRecord::Relation.include CoreExt::ActiveRecord::Relation
|
||||
Arel::Crud.prepend CoreExt::Arel::Crud
|
||||
Arel::Nodes::DeleteStatement.prepend CoreExt::Arel::Nodes::DeleteStatement
|
||||
Arel::Nodes::UpdateStatement.prepend CoreExt::Arel::Nodes::UpdateStatement
|
||||
Arel::SelectManager.prepend CoreExt::Arel::SelectManager
|
||||
Arel::TreeManager::StatementMethods
|
||||
.prepend CoreExt::Arel::TreeManager::StatementMethodsCteUpdateAndDelete
|
||||
Arel::Nodes::DeleteStatement
|
||||
.prepend CoreExt::Arel::Nodes::DeleteStatementCteUpdateAndDelete
|
||||
Arel::Nodes::UpdateStatement
|
||||
.prepend CoreExt::Arel::Nodes::UpdateStatementCteUpdateAndDelete
|
||||
Arel::Visitors::ToSql.prepend CoreExt::Arel::Visitors::ToSqlCteUpdateAndDelete
|
||||
Arel::Crud.prepend CoreExt::Arel::CrudCteUpdateAndDelete
|
||||
Arel::SelectManager.prepend CoreExt::Arel::SelectManagerCteUpdateAndDelete
|
||||
.prepend CoreExt::Arel::TreeManager::StatementMethods
|
||||
Arel::Visitors::ToSql.prepend CoreExt::Arel::Visitors::ToSql
|
||||
|
||||
# Currently not included patches for:
|
||||
# * https://github.com/rails/rails/issues/59706
|
||||
# * https://github.com/ruby-i18n/i18n/pull/755
|
||||
# * https://github.com/teamcapybara/capybara/pull/2862
|
||||
end
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelperUniqueId
|
||||
module CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper
|
||||
private
|
||||
|
||||
def unique
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module CoreExt::ActiveModel::Validations::NumericalityValidatesPrecision
|
||||
module CoreExt::ActiveModel::Validations::NumericalityValidator
|
||||
def validate_each(record, attr_name, value, **kwargs)
|
||||
super(record, attr_name, value, **kwargs)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module CoreExt::ActiveRecord::Relation
|
||||
INVALID_METHODS_FOR_UPDATE_AND_DELETE_ALL = [:distinct]
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
module CoreExt::ActiveRecord::Relation::UpdateAndDeleteCteSupport
|
||||
INVALID_METHODS_FOR_UPDATE_AND_DELETE_ALL = [:distinct]
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
module CoreExt::Arel::CrudCteUpdateAndDelete
|
||||
module CoreExt::Arel::Crud
|
||||
def compile_update(...)
|
||||
um = super
|
||||
um.with = subqueries
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module CoreExt::Arel::Nodes::UpdateStatementCteUpdateAndDelete
|
||||
module CoreExt::Arel::Nodes::DeleteStatement
|
||||
attr_accessor :with
|
||||
|
||||
def initialize(...)
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module CoreExt::Arel::Nodes::DeleteStatementCteUpdateAndDelete
|
||||
module CoreExt::Arel::Nodes::UpdateStatement
|
||||
attr_accessor :with
|
||||
|
||||
def initialize(...)
|
||||
@@ -0,0 +1,5 @@
|
||||
module CoreExt::Arel::SelectManager
|
||||
def subqueries
|
||||
@ast.with
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
module CoreExt::Arel::SelectManagerCteUpdateAndDelete
|
||||
def subqueries
|
||||
@ast.with
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
module CoreExt::Arel::TreeManager::StatementMethods
|
||||
def with=(expr)
|
||||
@ast.with = expr
|
||||
self
|
||||
end
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
module CoreExt::Arel::TreeManager::StatementMethodsCteUpdateAndDelete
|
||||
def with=(expr)
|
||||
@ast.with = expr
|
||||
self
|
||||
end
|
||||
end
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module CoreExt::Arel::Visitors::ToSqlCteUpdateAndDelete
|
||||
module CoreExt::Arel::Visitors::ToSql
|
||||
def visit_Arel_Nodes_DeleteStatement(o, collector)
|
||||
if o.with
|
||||
collector = visit o.with, collector
|
||||
@@ -1,4 +1,4 @@
|
||||
module CoreExt::XPath::DSL::NormalizeSpaceDefault
|
||||
module CoreExt::XPath::DSL
|
||||
def normalize_space(...)
|
||||
Capybara.default_normalize_ws ? super : current
|
||||
end
|
||||
Reference in New Issue
Block a user