diff --git a/LICENSE b/LICENSE index 6f04ed9e..6490c084 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019-2021 Dmitry Vorotilin +Copyright (c) 2019-2022 Dmitry Vorotilin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/ferrum/frame.rb b/lib/ferrum/frame.rb index fb22fd54..0f2089fb 100644 --- a/lib/ferrum/frame.rb +++ b/lib/ferrum/frame.rb @@ -68,11 +68,11 @@ def execution_id=(value) end def inspect - "#<#{self.class} "\ - "@id=#{@id.inspect} "\ - "@parent_id=#{@parent_id.inspect} "\ - "@name=#{@name.inspect} "\ - "@state=#{@state.inspect} "\ + "#<#{self.class} " \ + "@id=#{@id.inspect} " \ + "@parent_id=#{@parent_id.inspect} " \ + "@name=#{@name.inspect} " \ + "@state=#{@state.inspect} " \ "@execution_id=#{@execution_id.inspect}>" end end diff --git a/lib/ferrum/network.rb b/lib/ferrum/network.rb index 63f7f941..5d6520e8 100644 --- a/lib/ferrum/network.rb +++ b/lib/ferrum/network.rb @@ -14,7 +14,7 @@ class Network RESOURCE_TYPES = %w[Document Stylesheet Image Media Font Script TextTrack XHR Fetch EventSource WebSocket Manifest SignedExchange Ping CSPViolationReport Other].freeze - AUTHORIZE_BLOCK_MISSING = "Block is missing, call `authorize(...) { |r| r.continue } "\ + AUTHORIZE_BLOCK_MISSING = "Block is missing, call `authorize(...) { |r| r.continue } " \ "or subscribe to `on(:request)` events before calling it" AUTHORIZE_TYPE_WRONG = ":type should be in #{AUTHORIZE_TYPE}" ALLOWED_CONNECTION_TYPE = %w[none cellular2g cellular3g cellular4g bluetooth ethernet wifi wimax other].freeze diff --git a/lib/ferrum/network/auth_request.rb b/lib/ferrum/network/auth_request.rb index 34509d8c..8edd215a 100644 --- a/lib/ferrum/network/auth_request.rb +++ b/lib/ferrum/network/auth_request.rb @@ -56,10 +56,10 @@ def referrer_policy end def inspect - "#<#{self.class} "\ - "@request_id=#{@request_id.inspect} "\ - "@frame_id=#{@frame_id.inspect} "\ - "@resource_type=#{@resource_type.inspect} "\ + "#<#{self.class} " \ + "@request_id=#{@request_id.inspect} " \ + "@frame_id=#{@frame_id.inspect} " \ + "@resource_type=#{@resource_type.inspect} " \ "@request=#{@request.inspect}>" end end diff --git a/lib/ferrum/network/exchange.rb b/lib/ferrum/network/exchange.rb index 6fcf0bca..2c479339 100644 --- a/lib/ferrum/network/exchange.rb +++ b/lib/ferrum/network/exchange.rb @@ -43,11 +43,11 @@ def to_a end def inspect - "#<#{self.class} "\ - "@id=#{@id.inspect} "\ - "@intercepted_request=#{@intercepted_request.inspect} "\ - "@request=#{@request.inspect} "\ - "@response=#{@response.inspect} "\ + "#<#{self.class} " \ + "@id=#{@id.inspect} " \ + "@intercepted_request=#{@intercepted_request.inspect} " \ + "@request=#{@request.inspect} " \ + "@response=#{@response.inspect} " \ "@error=#{@error.inspect}>" end end diff --git a/lib/ferrum/network/intercepted_request.rb b/lib/ferrum/network/intercepted_request.rb index bfb90f2c..42574aff 100644 --- a/lib/ferrum/network/intercepted_request.rb +++ b/lib/ferrum/network/intercepted_request.rb @@ -75,10 +75,10 @@ def referrer_policy end def inspect - "#<#{self.class} "\ - "@request_id=#{@request_id.inspect} "\ - "@frame_id=#{@frame_id.inspect} "\ - "@resource_type=#{@resource_type.inspect} "\ + "#<#{self.class} " \ + "@request_id=#{@request_id.inspect} " \ + "@frame_id=#{@frame_id.inspect} " \ + "@resource_type=#{@resource_type.inspect} " \ "@request=#{@request.inspect}>" end diff --git a/lib/ferrum/page.rb b/lib/ferrum/page.rb index 3fdf74a6..a049fe23 100644 --- a/lib/ferrum/page.rb +++ b/lib/ferrum/page.rb @@ -167,11 +167,9 @@ def window_id @browser.command("Browser.getWindowForTarget", targetId: @target_id)["windowId"] end - # rubocop:disable Naming/AccessorMethodName def set_window_bounds(bounds = {}) @browser.command("Browser.setWindowBounds", windowId: window_id, bounds: bounds) end - # rubocop:enable Naming/AccessorMethodName def command(method, wait: 0, slowmoable: false, **params) iteration = @event.reset if wait.positive? diff --git a/lib/ferrum/page/screenshot.rb b/lib/ferrum/page/screenshot.rb index 5409d24c..f353ef3f 100644 --- a/lib/ferrum/page/screenshot.rb +++ b/lib/ferrum/page/screenshot.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "ferrum/rbga" +require "ferrum/rgba" module Ferrum class Page diff --git a/lib/ferrum/rbga.rb b/lib/ferrum/rgba.rb similarity index 100% rename from lib/ferrum/rbga.rb rename to lib/ferrum/rgba.rb diff --git a/spec/network_spec.rb b/spec/network_spec.rb index 30fe7183..519de9d1 100644 --- a/spec/network_spec.rb +++ b/spec/network_spec.rb @@ -321,8 +321,8 @@ module Ferrum expect do network.authorize(user: "login", password: "pass") end.to raise_exception(ArgumentError, - "Block is missing, call `authorize(...) { |r| r.continue }"\ - " or subscribe to `on(:request)` events before calling it") + "Block is missing, call `authorize(...) { |r| r.continue } " \ + "or subscribe to `on(:request)` events before calling it") end it "raises no error when authorize is with block" do diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 945151a3..642fd44b 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -30,7 +30,7 @@ module Ferrum browser.at_xpath("//a[text()='JS redirect']").click end.to raise_error( Ferrum::CoordinatesNotFoundError, - "Could not compute content quads" + "Node is either not visible or not an HTMLElement" ) end diff --git a/spec/rbga_spec.rb b/spec/rbga_spec.rb index 0d22f6ec..8c09a23e 100644 --- a/spec/rbga_spec.rb +++ b/spec/rbga_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "ferrum/rbga" +require "ferrum/rgba" module Ferrum describe RGBA do diff --git a/spec/screenshot_spec.rb b/spec/screenshot_spec.rb index 79f0864c..77318924 100644 --- a/spec/screenshot_spec.rb +++ b/spec/screenshot_spec.rb @@ -3,7 +3,7 @@ require "image_size" require "pdf/reader" require "chunky_png" -require "ferrum/rbga" +require "ferrum/rgba" module Ferrum describe Browser do