Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

do not use --profile parallel when user gave a profile, fixes #120

  • Loading branch information...
commit 8a38f02b65045d72bf50be5fb5c6b179329db061 1 parent d5595f1
@grosser authored
View
13 lib/parallel_tests/cucumber/runner.rb
@@ -10,8 +10,7 @@ def self.run_tests(test_files, process_number, options)
color,
executable,
(runtime_logging if File.directory?(File.dirname(runtime_log))),
- options[:test_options],
- cucumber_opts,
+ cucumber_opts(options[:test_options]),
*test_files
].compact.join(" ")
execute_command(cmd, process_number, options)
@@ -43,7 +42,15 @@ def self.line_is_result?(line)
line =~ /^\d+ (steps|scenarios)/
end
- def self.cucumber_opts
+ def self.cucumber_opts(given)
+ if given =~ /--profile/ or given =~ /(^|\s)-p /
+ given
+ else
+ [given, profile_from_config].compact.join(" ")
+ end
+ end
+
+ def self.profile_from_config
config = 'config/cucumber.yml'
if File.exists?(config) && File.read(config) =~ /^parallel:/
"--profile parallel"
View
27 spec/parallel_tests/cucumber/runner_spec.rb
@@ -53,12 +53,27 @@ def call(*args)
call(['xxx'],1,:test_options => '-p default')
end
- it "uses parallel profile if config/cucumber.yml contains it" do
- file_contents = 'parallel: -f progress'
- ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .* foo bar --profile parallel}}.and_return mocked_process
- File.should_receive(:exists?).with('config/cucumber.yml').and_return true
- File.should_receive(:read).with('config/cucumber.yml').and_return file_contents
- call(['xxx'],1, :test_options => 'foo bar')
+ context "with parallel profile in config/cucumber.yml" do
+ before do
+ file_contents = 'parallel: -f progress'
+ File.stub(:exists?).with('config/cucumber.yml').and_return true
+ File.stub(:read).with('config/cucumber.yml').and_return file_contents
+ end
+
+ it "uses parallel profile" do
+ ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .* foo bar --profile parallel xxx}}.and_return mocked_process
+ call(['xxx'],1, :test_options => 'foo bar')
+ end
+
+ it "uses given profile via --profile" do
+ ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .* --profile foo xxx$}}.and_return mocked_process
+ call(['xxx'],1, :test_options => '--profile foo')
+ end
+
+ it "uses given profile via -p" do
+ ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .* -p foo xxx$}}.and_return mocked_process
+ call(['xxx'],1, :test_options => '-p foo')
+ end
end
it "does not use parallel profile if config/cucumber.yml does not contain it" do
Please sign in to comment.
Something went wrong with that request. Please try again.