Skip to content

Commit 077682d

Browse files
authored
fix: linter (#345)
1 parent a6708f9 commit 077682d

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

lib/ferrum/network.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ def emulate_network_conditions(offline: false, latency: 0,
333333
#
334334
# @example
335335
# browser.network.offline_mode
336-
# browser.go_to("https://github.com/") # => Ferrum::StatusError (Request to https://github.com/ failed (net::ERR_INTERNET_DISCONNECTED))
336+
# browser.go_to("https://github.com/")
337+
# # => Request to https://github.com/ failed (net::ERR_INTERNET_DISCONNECTED) (Ferrum::StatusError)
337338
#
338339
def offline_mode
339340
emulate_network_conditions(offline: true, latency: 0, download_throughput: 0, upload_throughput: 0)

lib/ferrum/node.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def bounding_rect_coordinates
228228

229229
def content_quads
230230
quads = page.command("DOM.getContentQuads", nodeId: node_id)["quads"]
231-
raise CoordinatesNotFoundError, "Node is either not visible or not an HTMLElement" if quads.size.zero?
231+
raise CoordinatesNotFoundError, "Node is either not visible or not an HTMLElement" if quads.empty?
232232

233233
quads
234234
end

lib/ferrum/page.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ def go_to(url = nil)
114114
options = { url: combine_url!(url) }
115115
options.merge!(referrer: referrer) if referrer
116116
response = command("Page.navigate", wait: GOTO_WAIT, **options)
117-
raise StatusError.new(options[:url], "Request to #{options[:url]} failed (#{response['errorText']})") if response['errorText']
117+
error_text = response["errorText"]
118+
raise StatusError.new(options[:url], "Request to #{options[:url]} failed (#{error_text})") if error_text
118119

119120
response["frameId"]
120121
rescue TimeoutError

spec/browser/xvfb_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
def process_alive?(pid)
5858
return false unless pid
5959

60-
::Process.kill(0, pid) == 1
60+
Process.kill(0, pid) == 1
6161
rescue Errno::ESRCH
6262
false
6363
end

spec/unit/process_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55

66
unless Ferrum::Utils::Platform.windows?
77
it "forcibly kills the child if it does not respond to SIGTERM" do
8-
allow(::Process).to receive(:spawn).and_return(5678)
9-
allow(::Process).to receive(:wait).and_return(nil)
8+
allow(Process).to receive(:spawn).and_return(5678)
9+
allow(Process).to receive(:wait).and_return(nil)
1010
allow(Ferrum::Browser::Client).to receive(:new).and_return(double.as_null_object)
1111

1212
allow_any_instance_of(Ferrum::Browser::Process).to receive(:parse_ws_url)
1313

1414
subject.send(:start)
1515

16-
expect(::Process).to receive(:kill).with("USR1", 5678).ordered
17-
expect(::Process).to receive(:kill).with("KILL", 5678).ordered
16+
expect(Process).to receive(:kill).with("USR1", 5678).ordered
17+
expect(Process).to receive(:kill).with("KILL", 5678).ordered
1818

1919
subject.quit
2020
end
@@ -24,10 +24,10 @@
2424
subject { Ferrum::Browser.new(env: { "LD_PRELOAD" => "some.so" }) }
2525

2626
it "passes through env" do
27-
allow(::Process).to receive(:wait).and_return(nil)
27+
allow(Process).to receive(:wait).and_return(nil)
2828
allow(Ferrum::Browser::Client).to receive(:new).and_return(double.as_null_object)
2929

30-
allow(::Process).to receive(:spawn).with({ "LD_PRELOAD" => "some.so" }, any_args).and_return(123_456_789)
30+
allow(Process).to receive(:spawn).with({ "LD_PRELOAD" => "some.so" }, any_args).and_return(123_456_789)
3131

3232
allow_any_instance_of(Ferrum::Browser::Process).to receive(:parse_ws_url)
3333

0 commit comments

Comments
 (0)