1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

forgot the test, oops!

This commit is contained in:
Aaron Patterson 2013-10-30 15:03:34 -07:00
parent fe7ec5d52f
commit 9696073b2d

View file

@ -0,0 +1,36 @@
require 'active_support/test_case'
require 'active_support/testing/autorun'
require 'rails/generators/rails/app/app_generator'
module Rails
module Generators
class ARGVScrubberTest < ActiveSupport::TestCase
def test_version
['-v', '--version'].each do |str|
scrubber = ARGVScrubber.new [str]
output = nil
exit_code = nil
scrubber.extend(Module.new {
define_method(:puts) { |str| output = str }
define_method(:exit) { |code| exit_code = code }
})
scrubber.prepare
assert_equal "Rails #{Rails::VERSION::STRING}", output
assert_equal 0, exit_code
end
end
def test_prepare_returns_args
scrubber = ARGVScrubber.new ['hi mom']
args = scrubber.prepare
assert_equal '--help', args.first
end
def test_no_mutations
scrubber = ARGVScrubber.new ['hi mom'].freeze
args = scrubber.prepare
assert_equal '--help', args.first
end
end
end
end