make 'rails runner' show usage when run without any options

This commit is contained in:
Vijay Dev
2011-06-10 18:46:27 +05:30
parent 78acd17f31
commit 880371ef2b
2 changed files with 8 additions and 0 deletions

View File

@@ -4,6 +4,10 @@ require 'rbconfig'
options = { :environment => (ENV['RAILS_ENV'] || "development").dup }
code_or_file = nil
if ARGV.first.nil?
ARGV.push "-h"
end
ARGV.clone.options do |opts|
script_name = File.basename($0)
opts.banner = "Usage: runner [options] ('Some.ruby(code)' or a filename)"

View File

@@ -22,6 +22,10 @@ module ApplicationTests
teardown_app
end
def test_should_include_runner_in_shebang_line_in_help_without_option
assert_match "/rails runner", Dir.chdir(app_path) { `bundle exec rails runner` }
end
def test_should_include_runner_in_shebang_line_in_help
assert_match "/rails runner", Dir.chdir(app_path) { `bundle exec rails runner --help` }
end