diff options
author | Teddy Wing | 2017-04-29 21:55:48 +0200 |
---|---|---|
committer | Teddy Wing | 2017-04-29 21:55:48 +0200 |
commit | b700c1bef89a67a64f1040fb6bb03c0320eefe91 (patch) | |
tree | c7173b62b8a7d6f33c41544e14139c8b5f4a6a5a /spec/dbshell/client/database_spec.rb | |
parent | cf14e894685c695c7ecbaa2c119e2ea414afc00a (diff) | |
download | dbshell-rails-b700c1bef89a67a64f1040fb6bb03c0320eefe91.tar.bz2 |
Rename database client files to put them in a `Client` module
Will be modifying the class names in the next commit. Here we change the
file names & locations of the database client files.
The format changes thusly:
<adapter>_client.rb -> client/<adapter>.rb
This organisation feels cleaner to me. Wasn't liking the previous
structure.
Diffstat (limited to 'spec/dbshell/client/database_spec.rb')
-rw-r--r-- | spec/dbshell/client/database_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/dbshell/client/database_spec.rb b/spec/dbshell/client/database_spec.rb new file mode 100644 index 0000000..1659fa3 --- /dev/null +++ b/spec/dbshell/client/database_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 |