Skip to content

Commit

Permalink
[rb] fix rubocop violations
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Nov 27, 2019
1 parent b2b9211 commit 62e867b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
3 changes: 3 additions & 0 deletions rb/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,6 @@ RSpec/BeforeAfterAll:
RSpec/InstanceVariable:
Exclude:
- 'spec/unit/selenium/webdriver/socket_poller_spec.rb'

RSpec/DescribedClass:
Enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ module Selenium
module WebDriver
module DriverExtensions
describe HasNetworkConnection do
class FakeDriver
include HasNetworkConnection
attr_reader :bridge
def initialize(bridge)
@bridge = bridge
let(:fake_driver) do
Class.new(WebDriver::Driver) do
include HasNetworkConnection
attr_reader :bridge
def initialize(bridge)
@bridge = bridge
end
end
end

let(:driver) { FakeDriver.new(instance_double(Remote::Bridge)) }
let(:driver) { fake_driver.new(instance_double(Remote::Bridge)) }

describe '#network_connection' do
it 'returns the correct connection type' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ module Interactions
allow(pointer).to receive(:no_actions?).and_return(false)
expect(pointer.encode).to be_a(Hash)
end

it 'should contain a type key with the value of the type attribute' do
allow(pointer).to receive(:no_actions?).and_return(false)
expect(pointer.encode).to include(type: pointer.type)
Expand Down
14 changes: 8 additions & 6 deletions rb/spec/unit/selenium/webdriver/search_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@
module Selenium
module WebDriver
describe SearchContext do
class TestSearchContext
attr_reader :bridge, :ref
let(:test_search_context) do
Class.new do
attr_reader :bridge, :ref

include Selenium::WebDriver::SearchContext
include Selenium::WebDriver::SearchContext

def initialize(bridge)
@bridge = bridge
def initialize(bridge)
@bridge = bridge
end
end
end

let(:element) { instance_double(Element) }
let(:bridge) { instance_double('Bridge').as_null_object }
let(:search_context) { TestSearchContext.new(bridge) }
let(:search_context) { test_search_context.new(bridge) }

context 'finding a single element' do
it 'accepts a hash' do # rubocop:disable RSpec/RepeatedExample
Expand Down

0 comments on commit 62e867b

Please sign in to comment.