提交 76266a81 编写于 作者: R rohit 提交者: José Valim

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

上级 37de59ea
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
opts.separator "" opts.separator ""
opts.separator "You can also use runner as a shebang line for your scripts like this:" opts.separator "You can also use runner as a shebang line for your scripts like this:"
opts.separator "-------------------------------------------------------------" 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 ""
opts.separator "Product.find(:all).each { |p| p.price *= 2 ; p.save! }" opts.separator "Product.find(:all).each { |p| p.price *= 2 ; p.save! }"
opts.separator "-------------------------------------------------------------" opts.separator "-------------------------------------------------------------"
......
...@@ -18,6 +18,11 @@ def self.count ...@@ -18,6 +18,11 @@ def self.count
MODEL MODEL
end 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 def test_should_run_ruby_statement
assert_match "42", Dir.chdir(app_path) { `bundle exec rails runner "puts User.count"` } assert_match "42", Dir.chdir(app_path) { `bundle exec rails runner "puts User.count"` }
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册