aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-04-29 19:24:54 +0200
committerTeddy Wing2017-04-29 19:25:47 +0200
commit295407026c52216869a98dbed877a09edb801bc6 (patch)
tree4d6043ea294ec21cbbb8cd91ba30ceae2192558b
parentbb26c6d3a4f96a8e87cf14bb72ef283c86e8891a (diff)
downloaddbshell-rails-295407026c52216869a98dbed877a09edb801bc6.tar.bz2
Add `DBShell::Sqlite3Client`
Much simpler `.build_command` than the Postgres version. Only building arguments now. Want to try out executing the subprocess command. Inspired of course by: https://github.com/django/django/blob/66150f7cf61bc09547fa98586790df596eff6d77/django/db/backends/sqlite3/client.py
-rw-r--r--lib/dbshell/sqlite3_client.rb10
-rw-r--r--spec/dbshell/sqlite3_client_spec.rb16
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/dbshell/sqlite3_client.rb b/lib/dbshell/sqlite3_client.rb
new file mode 100644
index 0000000..7e962d7
--- /dev/null
+++ b/lib/dbshell/sqlite3_client.rb
@@ -0,0 +1,10 @@
+class DBShell::Sqlite3Client
+ EXECUTABLE_NAME = 'sqlite3'
+
+ def self.build_command(db_info)
+ args = [
+ EXECUTABLE_NAME,
+ db_info['database']
+ ]
+ end
+end
diff --git a/spec/dbshell/sqlite3_client_spec.rb b/spec/dbshell/sqlite3_client_spec.rb
new file mode 100644
index 0000000..4922993
--- /dev/null
+++ b/spec/dbshell/sqlite3_client_spec.rb
@@ -0,0 +1,16 @@
+require 'minitest/autorun'
+require 'dbshell/sqlite3_client'
+
+describe DBShell::Sqlite3Client do
+ describe ".build_command" do
+ it "builds basic arguments" do
+ DBShell::Sqlite3Client.build_command({
+ 'adapter' => 'sqlite3',
+ 'database' => 'db/development.sqlite3'
+ }).must_equal([
+ 'sqlite3',
+ 'db/development.sqlite3'
+ ])
+ end
+ end
+end