Skip to content

Commit

Permalink
resolver test stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
BuonOmo committed Aug 29, 2024
1 parent b93c79d commit 12db15e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/cases/database_configurations/resolver_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

require "cases/helper_cockroachdb"
require "support/copy_cat"

module ActiveRecord
module CockroachDB
class ConnectionAdapters
class PoolConfig
class ResolverTest < ::ActiveRecord::ConnectionAdapters::PoolConfig::ResolverTest
CopyCat.copy_methods(self, ActiveRecord::ConnectionAdapters::PoolConfig::ResolverTest,
:test_url_invalid_adapter,
debug: true) do
# HACK: there is a weird bug in the code copy that makes constants unavailable
# for some reason. This is a workaround.
def on_const(node)
return unless node in [:const, nil, :AdapterNotFound|:Base]

insert_before(node.loc.expression, "ActiveRecord::")
end

def on_str(node)
return unless node in [:str, /\ADatabase config/]

replace(node.loc.expression, node.children.first.sub("abstract,", "abstract, cockroachdb,").inspect)
end
end
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exclude :test_url_invalid_adapter, "rewritten to include cockroachdb in test"

0 comments on commit 12db15e

Please sign in to comment.