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'
|
require 'core_ext/range'
|
||||||
|
|
||||||
ActiveSupport.on_load :action_dispatch_system_test_case do
|
ActiveSupport.on_load :action_dispatch_system_test_case do
|
||||||
prepend CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelperUniqueId
|
# Add timestamp to screenshot filenames to make them unique.
|
||||||
# Allow denormalized string comparison,
|
prepend CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper
|
||||||
# https://github.com/orgs/teamcapybara/discussions/2841
|
|
||||||
XPath::DSL.prepend CoreExt::XPath::DSL::NormalizeSpaceDefault
|
# Allow denormalized string comparison:
|
||||||
|
# * https://github.com/orgs/teamcapybara/discussions/2841
|
||||||
|
XPath::DSL.prepend CoreExt::XPath::DSL
|
||||||
end
|
end
|
||||||
|
|
||||||
ActiveSupport.on_load :active_record do
|
ActiveSupport.on_load :active_record do
|
||||||
|
# Validate that number fits into Float data type.
|
||||||
ActiveModel::Validations::NumericalityValidator
|
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
|
Arel::TreeManager::StatementMethods
|
||||||
.prepend CoreExt::Arel::TreeManager::StatementMethodsCteUpdateAndDelete
|
.prepend CoreExt::Arel::TreeManager::StatementMethods
|
||||||
Arel::Nodes::DeleteStatement
|
Arel::Visitors::ToSql.prepend CoreExt::Arel::Visitors::ToSql
|
||||||
.prepend CoreExt::Arel::Nodes::DeleteStatementCteUpdateAndDelete
|
|
||||||
Arel::Nodes::UpdateStatement
|
# Currently not included patches for:
|
||||||
.prepend CoreExt::Arel::Nodes::UpdateStatementCteUpdateAndDelete
|
# * https://github.com/rails/rails/issues/59706
|
||||||
Arel::Visitors::ToSql.prepend CoreExt::Arel::Visitors::ToSqlCteUpdateAndDelete
|
# * https://github.com/ruby-i18n/i18n/pull/755
|
||||||
Arel::Crud.prepend CoreExt::Arel::CrudCteUpdateAndDelete
|
# * https://github.com/teamcapybara/capybara/pull/2862
|
||||||
Arel::SelectManager.prepend CoreExt::Arel::SelectManagerCteUpdateAndDelete
|
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
module CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelperUniqueId
|
module CoreExt::ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper
|
||||||
private
|
private
|
||||||
|
|
||||||
def unique
|
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)
|
def validate_each(record, attr_name, value, **kwargs)
|
||||||
super(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(...)
|
def compile_update(...)
|
||||||
um = super
|
um = super
|
||||||
um.with = subqueries
|
um.with = subqueries
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
module CoreExt::Arel::Nodes::UpdateStatementCteUpdateAndDelete
|
module CoreExt::Arel::Nodes::DeleteStatement
|
||||||
attr_accessor :with
|
attr_accessor :with
|
||||||
|
|
||||||
def initialize(...)
|
def initialize(...)
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
module CoreExt::Arel::Nodes::DeleteStatementCteUpdateAndDelete
|
module CoreExt::Arel::Nodes::UpdateStatement
|
||||||
attr_accessor :with
|
attr_accessor :with
|
||||||
|
|
||||||
def initialize(...)
|
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)
|
def visit_Arel_Nodes_DeleteStatement(o, collector)
|
||||||
if o.with
|
if o.with
|
||||||
collector = visit o.with, collector
|
collector = visit o.with, collector
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
module CoreExt::XPath::DSL::NormalizeSpaceDefault
|
module CoreExt::XPath::DSL
|
||||||
def normalize_space(...)
|
def normalize_space(...)
|
||||||
Capybara.default_normalize_ws ? super : current
|
Capybara.default_normalize_ws ? super : current
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user