Skip to content

Commit 2dba990

Browse files
committed
run 'bundle exec rubocop -A' to fix latest master build
1 parent 584c761 commit 2dba990

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

lib/ferrum/cookies.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def initialize(page)
5454

5555
def all
5656
cookies = @page.command("Network.getAllCookies")["cookies"]
57-
cookies.map { |c| [c["name"], Cookie.new(c)] }.to_h
57+
cookies.to_h { |c| [c["name"], Cookie.new(c)] }
5858
end
5959

6060
def [](name)

lib/ferrum/page/screenshot.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def document_size
7575
def save_file(path, data)
7676
return data unless path
7777

78-
File.open(path.to_s, "wb") { |f| f.write(data) }
78+
File.binwrite(path.to_s, data)
7979
end
8080

8181
def stream_to_file(handle, path:)

spec/keyboard_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ module Ferrum
305305

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

310310
element = browser.at_css("#change_me_file")
311311
element.set(filename)

spec/screenshot_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def create_screenshot(**options)
235235

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

241241
it "defaults to base64 when path isn't set" do

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def save_exception_screenshot(browser, filename, line_number, timestamp)
7878

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

0 commit comments

Comments
 (0)