Skip to content

run 'bundle exec rubocop -A' to fix latest master build #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ferrum/cookies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def initialize(page)

def all
cookies = @page.command("Network.getAllCookies")["cookies"]
cookies.map { |c| [c["name"], Cookie.new(c)] }.to_h
cookies.to_h { |c| [c["name"], Cookie.new(c)] }
end

def [](name)
Expand Down
2 changes: 1 addition & 1 deletion lib/ferrum/page/screenshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def document_size
def save_file(path, data)
return data unless path

File.open(path.to_s, "wb") { |f| f.write(data) }
File.binwrite(path.to_s, data)
end

def stream_to_file(handle, path:)
Expand Down
2 changes: 1 addition & 1 deletion spec/keyboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ module Ferrum

it "attaches a file when passed a Pathname", skip: true do
filename = Pathname.new("spec/tmp/a_test_pathname").expand_path
File.open(filename, "w") { |f| f.write("text") }
File.write(filename, "text")

element = browser.at_css("#change_me_file")
element.set(filename)
Expand Down
2 changes: 1 addition & 1 deletion spec/screenshot_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def create_screenshot(**options)

def create_screenshot(path:, **options)
image = browser.screenshot(format: format, encoding: :base64, **options)
File.open(path, "wb") { |f| f.write Base64.decode64(image) }
File.binwrite(path, Base64.decode64(image))
end

it "defaults to base64 when path isn't set" do
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def save_exception_screenshot(browser, filename, line_number, timestamp)

def save_exception_log(_browser, filename, line_number, timestamp, ferrum_logger)
log_name = "logfile-#{filename}-#{line_number}-#{timestamp}.txt"
File.open("/tmp/ferrum/#{log_name}", "wb") { |file| file.write(ferrum_logger.string) }
File.binwrite("/tmp/ferrum/#{log_name}", ferrum_logger.string)
rescue StandardError => e
puts "#{e.class}: #{e.message}"
end
Expand Down