diff --git a/spec/features/driver_spec.rb b/spec/features/driver_spec.rb index 8bbfe92..d9f9403 100644 --- a/spec/features/driver_spec.rb +++ b/spec/features/driver_spec.rb @@ -324,7 +324,7 @@ def create_screenshot(file, *args) def create_screenshot(file, *args) image = @driver.render_base64(format, *args) - File.open(file, "wb") { |f| f.write Base64.decode64(image) } + File.binwrite(file, Base64.decode64(image)) end it "supports rendering the page in base64" do diff --git a/spec/features/session_spec.rb b/spec/features/session_spec.rb index 6fc2de9..2a398ee 100644 --- a/spec/features/session_spec.rb +++ b/spec/features/session_spec.rb @@ -231,7 +231,7 @@ it "attaches a file when passed a Pathname" do filename = Pathname.new("spec/tmp/a_test_pathname").expand_path - File.open(filename, "w") { |f| f.write("text") } + File.write(filename, "text") element = @session.find(:css, "#change_me_file") element.set(filename) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 68baba8..458e500 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -120,7 +120,7 @@ def save_exception_screenshot(browser, filename, line_number, timestamp) def save_exception_log(browser, filename, line_number, timestamp) log_name = "logfile-#{filename}-#{line_number}-#{timestamp}.txt" - File.open("/tmp/cuprite/#{log_name}", "wb") { |f| f.write(browser.logger.string) } + File.binwrite("/tmp/cuprite/#{log_name}", browser.logger.string) rescue StandardError => e puts "#{e.class}: #{e.message}" end