diff --git a/spec/screen-recorder/screenshot_spec.rb b/spec/screen-recorder/screenshot_spec.rb index 102ef54..615be28 100644 --- a/spec/screen-recorder/screenshot_spec.rb +++ b/spec/screen-recorder/screenshot_spec.rb @@ -6,7 +6,7 @@ context 'when recording a desktop' do it 'can take a screenshot' do recorder.start - file = recorder.screenshot(image_file, 'ffmpeg.log') + file = recorder.screenshot(image_file, test_log_file) recorder.stop sleep(3) expect(file).to eq(image_file) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2e5e2d1..56dedfa 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -48,9 +48,8 @@ # Print error from ffmpeg log on test failure config.after do |example| if example.exception - # Print error from ffmpeg.log - log_file = 'ffmpeg.log' - File.open(log_file).readlines.last(10).join('\n') { puts "FFMPEG error: #{f}" } if log_file + # Print error from ffmpeg log + File.open(test_log_file).readlines.last(10).join('\n') { puts "FFMPEG error: #{f}" } end end end @@ -74,20 +73,20 @@ def test_input # Returns test output filename. # def test_output - file = "#{Dir.pwd}/recording-#{Time.now.to_i}.mkv" + file = "recording-#{Time.now.to_i}.mkv" return "#{Dir.home}/Desktop/#{file}" if OS.windows? - file + "#{Dir.pwd}/#{file}" end # # Returns test log filename. # def test_log_file - file = "screen-recorder-#{Time.now.to_i}.log" + file = 'ffmpeg.log' return "#{Dir.home}/Desktop/#{file}" if OS.windows? - file + "#{Dir.pwd}/#{file}" end #