mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
make 'rails runner' show usage when run without any options
This commit is contained in:
@@ -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)"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user