Skip to content

Commit

Permalink
Added support for DEXTER_URL in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jul 4, 2023
1 parent a875040 commit 3beda14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions test/connection_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
require_relative "test_helper"

class ConnectionTest < Minitest::Test
def setup
skip if ENV["DEXTER_URL"]
super
end

def test_flag
assert_connection ["-d", "dexter_test"]
end
Expand Down
5 changes: 3 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
require "minitest/pride"
require "dexter"

$conn = PG::Connection.open(dbname: "dexter_test")
$url = ENV["DEXTER_URL"] || "postgres:https:///dexter_test"
$conn = PG::Connection.new($url)
$conn.exec <<-SQL
SET client_min_messages = warning;
CREATE EXTENSION IF NOT EXISTS hstore;
Expand Down Expand Up @@ -40,7 +41,7 @@ def assert_no_index(statement, options = nil)
end

def dexter_run(options)
dexter = Dexter::Client.new(["dexter_test"] + options + ["--log-level", "debug2", "--log-sql"])
dexter = Dexter::Client.new([$url] + options + ["--log-level", "debug2", "--log-sql"])
ex = nil
stdout, _ = capture_io do
begin
Expand Down

0 comments on commit 3beda14

Please sign in to comment.