From 7b6d1e1b2c4a7991ceac7f4c7d07686c6f40d8ee Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 29 Apr 2017 18:24:03 +0200 Subject: Add preliminary test for `DBShell::PostgresClient` Thinking up an interface for generating command line arguments for the `psql` command. Based on Django's dbshell: https://github.com/django/django/blob/66150f7cf61bc09547fa98586790df596eff6d77/tests/dbshell/test_postgresql_psycopg2.py --- spec/dbshell/postgres_client_spec.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 spec/dbshell/postgres_client_spec.rb diff --git a/spec/dbshell/postgres_client_spec.rb b/spec/dbshell/postgres_client_spec.rb new file mode 100644 index 0000000..d1ace86 --- /dev/null +++ b/spec/dbshell/postgres_client_spec.rb @@ -0,0 +1,23 @@ +require 'minitest/autorun' + +describe DBShell::PostgresClient do + describe ".build_command" do + DBShell::PostgresClient.build_command({ + 'adapter' => 'postgresql', + 'host' => 'mailmarehost', + 'port' => 6027, + 'username' => 'derpyhooves', + 'password' => 'somepassword', + 'database' => 'dbname' + }).must_equal([ + 'psql', + '-U', + 'derpyhooves', + '-h', + 'mailmarehost', + '-p', + '6027', + 'dbname' + ]) + end +end -- cgit v1.2.3