Permalink
Browse files

Fix output of 'rails runner --help' [#4249 state:open]

  • Loading branch information...
1 parent 37de59e commit 76266a818449c732440e7e2ef4de8442ac6af891 @rohit rohit committed with josevalim Sep 16, 2010
Showing with 6 additions and 1 deletion.
  1. +1 −1 railties/lib/rails/commands/runner.rb
  2. +5 −0 railties/test/application/runner_test.rb
@@ -23,7 +23,7 @@
opts.separator ""
opts.separator "You can also use runner as a shebang line for your scripts like this:"
opts.separator "-------------------------------------------------------------"
- opts.separator "#!/usr/bin/env #{File.expand_path($0)}"
+ opts.separator "#!/usr/bin/env #{File.expand_path($0)} runner"
opts.separator ""
opts.separator "Product.find(:all).each { |p| p.price *= 2 ; p.save! }"
opts.separator "-------------------------------------------------------------"
@@ -18,6 +18,11 @@ def self.count
MODEL
end
+ def test_should_include_runner_in_shebang_line_in_help
+ # redirect stderr to stdout as backticks don't capture stderr
+ assert_match "/rails runner", Dir.chdir(app_path) { `bundle exec rails runner --help 2>&1` }
+ end
+
def test_should_run_ruby_statement
assert_match "42", Dir.chdir(app_path) { `bundle exec rails runner "puts User.count"` }
end

0 comments on commit 76266a8

Please sign in to comment.