Permalink
Browse files

do not passing extra info into ARGV

  • Loading branch information...
1 parent 64e2c74 commit 8f8d0339e40cc718dadeb5544a3f5e80fdaa5739 @allenwei committed Jan 17, 2011
Showing with 14 additions and 14 deletions.
  1. +7 −5 bin/rt
  2. +4 −4 features/cli.feature
  3. +3 −5 features/cli_load_path.feature
View
12 bin/rt
@@ -4,6 +4,9 @@ require File.join("rt.rb")
test_files = []
+options = []
+$: << File.join(".","test")
+
while f = ARGV.pop do
if f =~ /\*/
Dir.glob(f) do |test_file|
@@ -16,10 +19,10 @@ while f = ARGV.pop do
test_name = nil
%w[UnitTest ActiveSupportTestCase Shoulda].each do |matcher|
klass = eval("Rt::Matchers::#{matcher}")
- break if test_name = klass.test_name(line)
+ break if test_name = klass.test_name(line)
end
- if test_name
- ARGV << "--name=/#{test_name}/"
+ if !test_name.nil?
+ options << "--name=/#{test_name.strip}/"
test_files << file_name
else
STDERR.puts "Can not find test in file #{file_name} line #{line_num}"
@@ -33,7 +36,6 @@ while f = ARGV.pop do
test_files << f
end
end
-ARGV << "-Itest"
-STDOUT.puts "run test #{ARGV.join(' ')} #{test_files.join(', ')}"
+options.each {|o| ARGV << o }
test_files.each {|f| load f}
View
@@ -15,22 +15,22 @@ Feature: Runner
"""
Scenario: Run single file from command-line
- When I run "bundle exec rt test/test_one.rb"
+ When I successfully run "bundle exec rt test/test_one.rb"
Then the stdout should contain "1 tests, 1 assertions, 0 failures, 0 errors"
And the exit status should be 0
Scenario: Run two file from command-line
- When I run "bundle exec rt test/test_one.rb test/test_two.rb"
+ When I successfully run "bundle exec rt test/test_one.rb test/test_two.rb"
Then the stdout should contain "2 tests, 2 assertions, 0 failures, 0 errors"
And the exit status should be 0
Scenario: Run tests in folder
- When I run "bundle exec rt test"
+ When I successfully run "bundle exec rt test"
Then the stdout should contain "2 tests, 2 assertions, 0 failures, 0 errors"
And the exit status should be 0
Scenario: Run tests with regular expression
- When I run "bundle exec rt **/*_one.rb"
+ When I successfully run "bundle exec rt **/*_one.rb"
Then the stdout should contain "1 tests, 1 assertions, 0 failures, 0 errors"
And the exit status should be 0
@@ -3,7 +3,7 @@ Feature: Load path when running test
Scenario: default load path is "test" folder
Given a file named "test/test_helper.rb" with:
"""
- puts 'load test_helper'
+ #no thing
"""
And a test file "test_one.rb" with:
"""
@@ -13,7 +13,5 @@ Feature: Load path when running test
assert true
end
"""
- When I run "bundle exec rt test_one.rb"
- Then the stdout should contain "load test_helper"
- And the stdout should contain "1 tests, 1 assertions, 0 failures, 0 errors"
- And the exit status should be 0
+ When I successfully run "bundle exec rt test_one.rb"
+ Then the stdout should contain "1 tests, 1 assertions, 0 failures, 0 errors"

0 comments on commit 8f8d033

Please sign in to comment.