mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Fix DB::DriverSpecs#with_db
connection_string
query param support (#192)
This commit is contained in:
parent
38faf7eeba
commit
a527cfdc4e
1 changed files with 10 additions and 1 deletions
11
src/spec.cr
11
src/spec.cr
|
@ -396,7 +396,16 @@ module DB
|
||||||
# :nodoc:
|
# :nodoc:
|
||||||
def with_db(options = nil)
|
def with_db(options = nil)
|
||||||
@before.call
|
@before.call
|
||||||
DB.open("#{connection_string}#{"?#{options}" if options}") do |db|
|
|
||||||
|
if options
|
||||||
|
uri = URI.parse connection_string
|
||||||
|
uri.query_params.merge! URI::Params.parse(options)
|
||||||
|
connection_string_with_options = uri.to_s
|
||||||
|
else
|
||||||
|
connection_string_with_options = connection_string
|
||||||
|
end
|
||||||
|
|
||||||
|
DB.open(connection_string_with_options) do |db|
|
||||||
db.exec(sql_drop_table("table1"))
|
db.exec(sql_drop_table("table1"))
|
||||||
db.exec(sql_drop_table("table2"))
|
db.exec(sql_drop_table("table2"))
|
||||||
db.exec(sql_drop_table("person"))
|
db.exec(sql_drop_table("person"))
|
||||||
|
|
Loading…
Reference in a new issue