Skip to content

Commit

Permalink
Merge pull request #237 from rubycdp/support/fix-linter-offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
Mifrill authored Apr 8, 2022
2 parents 584c761 + 2dba990 commit 2c087c5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
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

0 comments on commit 2c087c5

Please sign in to comment.