Skip to content

Commit

Permalink
Run selected unit/test by name. Issue jstorimer#9
Browse files Browse the repository at this point in the history
  • Loading branch information
sacre authored and Paweł Pałucki committed Jan 22, 2012
1 parent 05e104d commit 979854e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -41,6 +41,12 @@ Or push multiple files to be loaded at once:
spin push test/unit/product_test.rb test/unit/shop_test.rb test/unit/cart_test.rb
```

Or push selected test by name (executed as -n '/test_newproduct/')

``` bash
spin push test/unit/product_test.rb:test_newproduct
```

Or, when using RSpec, run the whole suite:

``` bash
Expand Down
10 changes: 9 additions & 1 deletion bin/spin
Expand Up @@ -170,7 +170,15 @@ def fork_and_run(files, push_results, test_framework, conn)
ARGV.push files
else
# We require the full path of the file here in the child process.
files.each { |f| require File.expand_path f }
# Run only selected test by name.
# Add -n with all given names as Regexp eg. /name1|name2|name3/
names = "/#{files.map{|f|f.split(':')[1]}.reject(&:nil?).join('|')}/"
unless names == '//'
ARGV << '-n'
ARGV << names
puts "Test names: #{names}"
end
files.each { |f| require File.expand_path f.split(':')[0] }
end

end
Expand Down

0 comments on commit 979854e

Please sign in to comment.