Skip to content

Commit

Permalink
Fix output and log filepaths
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoorlakshya authored Jul 20, 2024
1 parent 615d64b commit 99270a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion spec/screen-recorder/screenshot_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 6 additions & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

#
Expand Down

0 comments on commit 99270a2

Please sign in to comment.