Permalink
Browse files

Add metatest

  • Loading branch information...
semaperepelitsa committed Feb 25, 2012
1 parent 8b2c1a0 commit 2ddc4a96933f711f6d376eda62681887986aa87b
Showing with 33 additions and 4 deletions.
  1. +9 −4 lib/spork/test_framework/minitest.rb
  2. +24 −0 metatest/test_spork_minitest.rb
@@ -7,15 +7,20 @@ def run_tests(argv, stderr, stdout)
$LOAD_PATH << "test" << "."
::MiniTest::Unit.output = stdout
- paths, opts = argv.slice_before("--").to_a
- paths ||= []
- opts ||= []
- opts.shift
+ paths, opts = parse_options(argv)
paths.each do |path|
require path
end
::MiniTest::Unit.new.run(opts)
end
+
+ def parse_options(argv)
+ paths, opts = argv.slice_before("--").to_a
+ paths ||= []
+ opts ||= []
+ opts.shift
+ [paths, opts]
+ end
end
@@ -0,0 +1,24 @@
+require "minitest/autorun"
+
+module Spork
+ class TestFramework
+ end
+end
+
+require "spork/test_framework/minitest"
+
+class TestParseOptions < MiniTest::Unit::TestCase
+ def test_full
+ assert_equal [%w[foo bar], %w[--seed 123]], parse_options(%w[foo bar -- --seed 123])
+ end
+
+ def test_only_paths
+ assert_equal [%w[foo bar], []], parse_options(%w[foo bar])
+ end
+
+ def parse_options(*args, &block)
+ @runner ||= Spork::TestFramework::MiniTest.new
+ @runner.parse_options(*args, &block)
+ end
+end
+

0 comments on commit 2ddc4a9

Please sign in to comment.