aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorAlexey Vakhov <vakhov@gmail.com>2012-05-04 12:54:20 +0400
committerAlexey Vakhov <vakhov@gmail.com>2012-05-22 08:59:25 +0400
commita060c41ef77cf3a0e4d236a70f3fef260ff9a261 (patch)
tree6f4d86f7bb016ec2221f6dd4795e6e7589992a0f /railties/test
parent1447aca70f231f07eedee9572bd45da6a175262b (diff)
downloadrails-a060c41ef77cf3a0e4d236a70f3fef260ff9a261.tar.gz
rails-a060c41ef77cf3a0e4d236a70f3fef260ff9a261.tar.bz2
rails-a060c41ef77cf3a0e4d236a70f3fef260ff9a261.zip
Use relative path to sqlite3 db in `rails db` command
Rails uses sqlit3 db file with a path relative to the rails root. It allows to execute server not from rails root only. For example you can fire `./spec/dummy/script/rails s` to start dummy application server if you develop some engine gem. Now the `rails db` command uses relative paths also and you can explore your dummy db via `./spec/dummy/script/rails db` command.
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/commands/dbconsole_test.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/railties/test/commands/dbconsole_test.rb b/railties/test/commands/dbconsole_test.rb
index 85a7edfacd..57074cd0ad 100644
--- a/railties/test/commands/dbconsole_test.rb
+++ b/railties/test/commands/dbconsole_test.rb
@@ -92,20 +92,25 @@ class Rails::DBConsoleTest < ActiveSupport::TestCase
end
def test_sqlite3
- dbconsole.expects(:find_cmd_and_exec).with('sqlite3', 'db')
- start(adapter: 'sqlite3', database: 'db')
+ dbconsole.expects(:find_cmd_and_exec).with('sqlite3', Rails.root.join('db.sqlite3').to_s)
+ start(adapter: 'sqlite3', database: 'db.sqlite3')
assert !aborted
end
def test_sqlite3_mode
- dbconsole.expects(:find_cmd_and_exec).with('sqlite3', '-html', 'db')
- start({adapter: 'sqlite3', database: 'db'}, ['--mode', 'html'])
+ dbconsole.expects(:find_cmd_and_exec).with('sqlite3', '-html', Rails.root.join('db.sqlite3').to_s)
+ start({adapter: 'sqlite3', database: 'db.sqlite3'}, ['--mode', 'html'])
assert !aborted
end
def test_sqlite3_header
- dbconsole.expects(:find_cmd_and_exec).with('sqlite3', '-header', 'db')
- start({adapter: 'sqlite3', database: 'db'}, ['--header'])
+ dbconsole.expects(:find_cmd_and_exec).with('sqlite3', '-header', Rails.root.join('db.sqlite3').to_s)
+ start({adapter: 'sqlite3', database: 'db.sqlite3'}, ['--header'])
+ end
+
+ def test_sqlite3_db_absolute_path
+ dbconsole.expects(:find_cmd_and_exec).with('sqlite3', '/tmp/db.sqlite3')
+ start(adapter: 'sqlite3', database: '/tmp/db.sqlite3')
assert !aborted
end