Skip to content
Browse files

forgot the test, oops!

  • Loading branch information...
1 parent fe7ec5d commit 9696073b2db210745738c8328a6524ea6dc57fff @tenderlove tenderlove committed Oct 30, 2013
Showing with 36 additions and 0 deletions.
  1. +36 −0 railties/test/generators/argv_scrubber_test.rb
View
36 railties/test/generators/argv_scrubber_test.rb
@@ -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

0 comments on commit 9696073

Please sign in to comment.
Something went wrong with that request. Please try again.