Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use --profile for cucumber so we do not have to read the file

  • Loading branch information...
commit 27050997501741f3d052884d83453b9781f746f3 1 parent 7a01a8f
@grosser authored
View
19 lib/parallel_tests/cucumber/runner.rb
@@ -6,10 +6,14 @@ class Runner < ParallelTests::Test::Runner
def self.run_tests(test_files, process_number, options)
color = ($stdout.tty? ? 'AUTOTEST=1 ; export AUTOTEST ;' : '')#display color when we are in a terminal
runtime_logging = " --format ParallelTests::Cucumber::RuntimeLogger --out #{runtime_log}"
- options[:test_options] = options[:test_options].nil? ? cucumber_opts : "#{options[:test_options]} #{cucumber_opts}".strip
- cmd = "#{color} #{executable}"
- cmd << runtime_logging if File.directory?(File.dirname(runtime_log))
- cmd << " #{options[:test_options]} #{test_files*' '}"
+ cmd = [
+ color,
+ executable,
+ (runtime_logging if File.directory?(File.dirname(runtime_log))),
+ options[:test_options],
+ cucumber_opts,
+ *test_files
+ ].compact.join(" ")
execute_command(cmd, process_number, options)
end
@@ -40,10 +44,9 @@ def self.line_is_result?(line)
end
def self.cucumber_opts
- if File.exists?('config/cucumber.yml') && (options = File.read('config/cucumber.yml').match(/^parallel:(.*)$/))
- options[1].strip
- else
- ''
+ config = 'config/cucumber.yml'
+ if File.exists?(config) && File.read(config) =~ /^parallel:/
+ "--profile parallel"
end
end
end
View
24 spec/parallel_tests/cucumber/runner_spec.rb
@@ -53,27 +53,27 @@ def call(*args)
call(['xxx'],1,:test_options => '-p default')
end
- it "uses the contents of a config/cucumber.yml file as options" do
+ 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 .* -f progress}}.and_return mocked_process
+ 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,{})
+ call(['xxx'],1, :test_options => 'foo bar')
+ end
+
+ it "does not use parallel profile if config/cucumber.yml does not contain it" do
+ file_contents = 'blob: -f progress'
+ ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .* foo bar}}.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')
end
- it "doesn't use the contents of a config/cucumber.yml file when it's not available" do
+ it "does not use the parallel profile if config/cucumber.yml does not exist" do
ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .*}}.and_return mocked_process
File.should_receive(:exists?).with('config/cucumber.yml').and_return false
call(['xxx'],1,{})
end
-
- it "merges the contents of a config/cucumber.yml file with the current test options" do
- file_contents = 'parallel: -f progress'
- ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .* -p default -f progress}}.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 => '-p default')
- end
end
describe :find_results do
Please sign in to comment.
Something went wrong with that request. Please try again.