From 900fa7d164ee28226633236d09a1810c07c26689 Mon Sep 17 00:00:00 2001 From: Aleksandar Kostadinov Date: Tue, 9 May 2017 19:03:33 +0300 Subject: [PATCH] use absolute path to avoid chdir issues --- lib/cucumber/formatter/io.rb | 2 +- spec/cucumber/formatter/junit_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cucumber/formatter/io.rb b/lib/cucumber/formatter/io.rb index a914e89753..cabd111424 100644 --- a/lib/cucumber/formatter/io.rb +++ b/lib/cucumber/formatter/io.rb @@ -26,7 +26,7 @@ def ensure_dir(path, name) raise "You *must* specify --out DIR for the #{name} formatter" unless String === path raise "I can't write #{name} reports to a file - it has to be a directory" if File.file?(path) FileUtils.mkdir_p(path) unless File.directory?(path) - path + File.absolute_path path end end end diff --git a/spec/cucumber/formatter/junit_spec.rb b/spec/cucumber/formatter/junit_spec.rb index 5a44562c9d..0f0941ded5 100644 --- a/spec/cucumber/formatter/junit_spec.rb +++ b/spec/cucumber/formatter/junit_spec.rb @@ -117,8 +117,8 @@ def after_step(step) Given a passing scenario }, File.join('features', 'some', 'path', 'spec.feature') - it 'writes the filename including the subdirectory' do - expect(@formatter.written_files.keys.first).to eq File.join('', 'TEST-features-some-path-spec.xml') + it 'writes the filename with absolute path' do + expect(@formatter.written_files.keys.first).to eq File.absolute_path('TEST-features-some-path-spec.xml') end end