aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
diff options
context:
space:
mode:
authorAlexey Vakhov <vakhov@gmail.com>2012-05-04 22:04:53 +0400
committerAlexey Vakhov <vakhov@gmail.com>2012-05-22 08:59:30 +0400
commit1fed1f14fc0ecb375d8a7c542669dad96541582d (patch)
tree66d95d8ac395ce244ab103e6e77bb2fa10efd087 /railties/test/commands
parenta060c41ef77cf3a0e4d236a70f3fef260ff9a261 (diff)
downloadrails-1fed1f14fc0ecb375d8a7c542669dad96541582d.tar.gz
rails-1fed1f14fc0ecb375d8a7c542669dad96541582d.tar.bz2
rails-1fed1f14fc0ecb375d8a7c542669dad96541582d.zip
Fix `rails db -h` and cosmetic fixes in usage banners
Ruby tries to use '-h' as short version of '--header' by default https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L1372-1381. To force `rails db -h` prints an usage message we should add the `-h` options explicitly.
Diffstat (limited to 'railties/test/commands')
-rw-r--r--railties/test/commands/dbconsole_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/railties/test/commands/dbconsole_test.rb b/railties/test/commands/dbconsole_test.rb
index 57074cd0ad..6d0f5ca073 100644
--- a/railties/test/commands/dbconsole_test.rb
+++ b/railties/test/commands/dbconsole_test.rb
@@ -132,6 +132,24 @@ class Rails::DBConsoleTest < ActiveSupport::TestCase
assert_match /Unknown command-line client for db/, output
end
+ def test_print_help_short
+ stdout = capture(:stdout) do
+ start({}, ['-h'])
+ end
+ assert aborted
+ assert_equal '', output
+ assert_match /Usage:.*dbconsole/, stdout
+ end
+
+ def test_print_help_long
+ stdout = capture(:stdout) do
+ start({}, ['--help'])
+ end
+ assert aborted
+ assert_equal '', output
+ assert_match /Usage:.*dbconsole/, stdout
+ end
+
private
attr_reader :aborted, :output