-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
1 change: 1 addition & 0 deletions
1
test/excludes/ActiveRecord/ConnectionAdapters/PoolConfig/ResolverTest.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exclude :test_url_invalid_adapter, "rewritten to include cockroachdb in test" |