Permalink
Browse files

add a test for the rc commandline option

  • Loading branch information...
1 parent 327c602 commit 2f11668eb844f6d7d64eaf4b4856d8a8b41e3a0c @tenderlove tenderlove committed Oct 30, 2013
Showing with 18 additions and 0 deletions.
  1. +18 −0 railties/test/generators/argv_scrubber_test.rb
@@ -64,6 +64,24 @@ def test_new_homedir_rc
file.unlink
end
+ def test_new_rc_option
+ file = Tempfile.new 'myrcfile'
+ file.puts '--hello-world'
+ file.flush
+
+ message = nil
+ scrubber = Class.new(ARGVScrubber) {
+ define_method(:puts) { |msg| message = msg }
+ }.new ['new', "--rc=#{file.path}"]
+ args = scrubber.prepare!
+ assert_equal [nil, '--hello-world'], args
+ assert_match 'hello-world', message
+ assert_match file.path, message
+ ensure
+ file.close
+ file.unlink
+ end
+
def test_no_rc
scrubber = ARGVScrubber.new ['new', '--no-rc']
args = scrubber.prepare!

0 comments on commit 2f11668

Please sign in to comment.