aboutsummaryrefslogtreecommitdiffstats
path: root/spec/dbshell/client/database_spec.rb
blob: 5fe5597b6218805220c9049dd0ff1c2b57f10ab2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'minitest/autorun'
require 'dbshell/client/database'

describe DBShell::Client::Database do
  describe ".handler" do
    it "handles SQLite3" do
      DBShell::Client::Database.handler({
        'adapter' => 'sqlite3'
      }).must_equal(DBShell::Client::Sqlite3)
    end

    it "handles Postgres" do
      DBShell::Client::Database.handler({
        'adapter' => 'postgresql'
      }).must_equal(DBShell::Client::Postgres)
    end

    it "raises an error if no suitable adapter is found" do
      proc do
        DBShell::Client::Database.handler({
          'adapter' => 'sybil_system'
        })
      end.must_raise(DBShell::InvalidDatabaseAdapter)
    end
  end
end