aboutsummaryrefslogtreecommitdiffstats
path: root/spec/dbshell/database_client_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/dbshell/database_client_spec.rb')
-rw-r--r--spec/dbshell/database_client_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/dbshell/database_client_spec.rb b/spec/dbshell/database_client_spec.rb
new file mode 100644
index 0000000..1659fa3
--- /dev/null
+++ b/spec/dbshell/database_client_spec.rb
@@ -0,0 +1,26 @@
+require 'minitest/autorun'
+require 'dbshell/database_client'
+
+describe DBShell::DatabaseClient do
+ describe ".handler" do
+ it "handles SQLite3" do
+ DBShell::DatabaseClient.handler({
+ 'adapter' => 'sqlite3'
+ }).must_equal(DBShell::Sqlite3Client)
+ end
+
+ it "handles Postgres" do
+ DBShell::DatabaseClient.handler({
+ 'adapter' => 'postgresql'
+ }).must_equal(DBShell::PostgresClient)
+ end
+
+ it "raises an error if no suitable adapter is found" do
+ proc do
+ DBShell::DatabaseClient.handler({
+ 'adapter' => 'sybil_system'
+ })
+ end.must_raise(DBShell::InvalidDatabaseAdapter)
+ end
+ end
+end