spec/integration_spec.rb in parallel_tests-0.6.17 vs spec/integration_spec.rb in parallel_tests-0.6.18
- old
+ new
@@ -48,11 +48,11 @@
result.scan(/Took \d+\.\d+ seconds/).size.should == 1 # parallel summary
$?.success?.should == true
end
it "does not run any tests if there are none" do
- write 'spec/xxx.rb', 'xxx'
+ write 'spec/xxx_spec.rb', '1'
result = run_tests
result.should include('No examples found')
result.should include('Took')
end
@@ -110,24 +110,52 @@
result.should include('333')
result.should_not include('222')
end
it "can run with test-options" do
- write "spec/x1_spec.rb", ""
- write "spec/x2_spec.rb", ""
+ write "spec/x1_spec.rb", "111"
+ write "spec/x2_spec.rb", "111"
result = run_tests(:add => "--test-options ' --version'", :processes => 2)
result.should =~ /\d+\.\d+\.\d+.*\d+\.\d+\.\d+/m # prints version twice
end
- it "runs with test::unit" do
- write "test/x1_test.rb", "require 'test/unit'; class XTest < Test::Unit::TestCase; def test_xxx; end; end"
- result = run_tests(:type => :test)
- result.should include('1 test')
- $?.success?.should == true
+ context "Test::Unit" do
+ it "runs" do
+ write "test/x1_test.rb", "require 'test/unit'; class XTest < Test::Unit::TestCase; def test_xxx; end; end"
+ result = run_tests(:type => :test)
+ result.should include('1 test')
+ $?.success?.should == true
+ end
+
+ it "passes test options" do
+ write "test/x1_test.rb", "require 'test/unit'; class XTest < Test::Unit::TestCase; def test_xxx; end; end"
+ result = run_tests(:type => :test, :add => '--test-options "-v"')
+ result.should include('test_xxx') # verbose output of every test
+ end
end
- it "passes test options to test::unit" do
- write "test/x1_test.rb", "require 'test/unit'; class XTest < Test::Unit::TestCase; def test_xxx; end; end"
- result = run_tests(:type => :test, :add => '--test-options "-v"')
- result.should include('test_xxx') # verbose output of every test
+ context "Cucumber" do
+ it "passes TEST_ENV_NUMBER when running with pattern (issue #86)" do
+ write "features/good1.feature", "Feature: xxx\n Scenario: xxx\n Given I print TEST_ENV_NUMBER"
+ write "features/good2.feature", "Feature: xxx\n Scenario: xxx\n Given I print TEST_ENV_NUMBER"
+ write "features/b.feature", "Feature: xxx\n Scenario: xxx\n Given I FAIL"
+ write "features/steps/a.rb", "Given('I print TEST_ENV_NUMBER'){ puts \"YOUR TEST ENV IS \#{ENV['TEST_ENV_NUMBER']}!\" }"
+
+ result = run_tests :type => 'features', :add => '--pattern good'
+ $?.success?.should == true
+
+ result.should include('YOUR TEST ENV IS 2!')
+ result.should include('YOUR TEST ENV IS !')
+ result.should_not include('I FAIL')
+ end
+
+ it "runs each feature once when there are more processes then features (issue #89)" do
+ write "features/steps/a.rb", "Given('I print TEST_ENV_NUMBER'){ puts \"YOUR TEST ENV IS \#{ENV['TEST_ENV_NUMBER']}!\" }"
+ 2.times{|i|
+ write "features/good#{i}.feature", "Feature: xxx\n Scenario: xxx\n Given I print TEST_ENV_NUMBER"
+ }
+ result = run_tests :type => 'features', :add => '-n 3'
+ $?.success?.should == true
+ result.scan(/YOUR TEST ENV IS \d?!/).sort.should == ["YOUR TEST ENV IS !", "YOUR TEST ENV IS 2!"]
+ end
end
end