Skip to content

Commit

Permalink
add a test for the rc commandline option
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Oct 30, 2013
1 parent 327c602 commit 2f11668
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions railties/test/generators/argv_scrubber_test.rb
Expand Up @@ -64,6 +64,24 @@ def test_new_homedir_rc
file.unlink file.unlink
end 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 def test_no_rc
scrubber = ARGVScrubber.new ['new', '--no-rc'] scrubber = ARGVScrubber.new ['new', '--no-rc']
args = scrubber.prepare! args = scrubber.prepare!
Expand Down

0 comments on commit 2f11668

Please sign in to comment.