Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rb/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ RSpec/MultipleExpectations:

RSpec/NoExpectationExample:
Exclude:
- 'spec/integration/selenium/webdriver/guard_spec.rb'
- 'spec/unit/selenium/webdriver/guards_spec.rb'
- 'spec/integration/selenium/webdriver/takes_screenshot_spec.rb'

RSpec/MultipleMemoizedHelpers:
Expand Down
6 changes: 3 additions & 3 deletions rb/spec/integration/selenium/webdriver/ie/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
module Selenium
module WebDriver
module IE
describe Service, {exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :ie}],
exclude: {driver: :remote}} do

describe Service,
{exclude: {driver: :remote},
exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :ie}]} do
let(:service) { described_class.new }
let(:service_manager) { service.launch }

Expand Down
5 changes: 3 additions & 2 deletions rb/spec/integration/selenium/webdriver/safari/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
module Selenium
module WebDriver
module Safari
describe Service, { exclusive: [{ bidi: false, reason: 'Not yet implemented with BiDi' }, { browser: :safari }],
exclude: {driver: :remote}} do
describe Service,
{exclude: {driver: :remote},
exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :safari}]} do
let(:service) { described_class.new }
let(:service_manager) { service.launch }

Expand Down
37 changes: 19 additions & 18 deletions rb/spec/unit/selenium/webdriver/guards_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,79 +34,80 @@ module Support

context 'with single guard' do
describe '#exclude' do
it 'ignores an unrecognized guard parameter', invalid: { condition: :guarded } do
it 'ignores an unrecognized guard parameter', invalid: {condition: :guarded} do
# pass
end

it 'skips without running', exclude: { condition: :guarded } do
it 'skips without running', exclude: {condition: :guarded} do
raise 'This code will not get executed so it will not fail'
end
end

describe '#flaky' do
it 'skips without running', flaky: { condition: :guarded } do
it 'skips without running', flaky: {condition: :guarded} do
raise 'This code will not get executed so it will not fail'
end
end

describe '#exclusive' do
it 'skips without running if it does not match', exclusive: { condition: :not_guarded } do
it 'skips without running if it does not match', exclusive: {condition: :not_guarded} do
raise 'This code will not get executed so it will not fail'
end

it 'does not guard if it does match', exclusive: { condition: :guarded } do
it 'does not guard if it does match', exclusive: {condition: :guarded} do
# pass
end
end

describe '#only' do
it 'guards when value does not match', only: { condition: :not_guarded } do
it 'guards when value does not match', only: {condition: :not_guarded} do
raise 'This code is executed but expected to fail'
end

it 'does not guard when value matches', only: { condition: :guarded } do
it 'does not guard when value matches', only: {condition: :guarded} do
# pass
end
end

describe '#except' do
it 'guards when value matches and test fails', except: { condition: :guarded } do
it 'guards when value matches and test fails', except: {condition: :guarded} do
raise 'This code is executed but expected to fail'
end

it 'does not guard when value does not match and test passes', except: { condition: :not_guarded } do
it 'does not guard when value does not match and test passes', except: {condition: :not_guarded} do
# pass
end
end
end

context 'when multiple guards' do
it 'guards if neither only nor except match and test fails', except: { condition: :not_guarded },
only: { condition: :not_guarded } do
it 'guards if neither only nor except match and test fails', except: {condition: :not_guarded},
only: {condition: :not_guarded} do
raise 'This code is executed but expected to fail'
end

it 'guards if both only and except match', except: { condition: :guarded }, only: { condition: :guarded } do
it 'guards if both only and except match', except: {condition: :guarded}, only: {condition: :guarded} do
raise 'This code is executed but expected to fail'
end

it 'guards if except matches and only does not', except: { condition: :guarded }, only: { condition: :not_guarded } do
it 'guards if except matches and only does not', except: {condition: :guarded},
only: {condition: :not_guarded} do
raise 'This code is executed but expected to fail'
end

it 'does not guard if only matches and except does not', except: { condition: :not_guarded },
only: { condition: :guarded } do
it 'does not guard if only matches and except does not', except: {condition: :not_guarded},
only: {condition: :guarded} do
# pass
end

it 'gives correct reason', except: [{ condition: :guarded, reason: 'bug1' },
{ condition: :not_guarded, reason: 'bug2' }] do
it 'gives correct reason', except: [{condition: :guarded, reason: 'bug1'},
{condition: :not_guarded, reason: 'bug2'}] do
raise 'This code is executed but expected to fail'
end
end

context 'when array of hashes' do
it 'guards if any Hash value is satisfied', only: [{ condition: :guarded }, { condition: :not_guarded }] do
it 'guards if any Hash value is satisfied', only: [{condition: :guarded}, {condition: :not_guarded}] do
raise 'This code is executed but expected to fail'
end
end
Expand Down
Loading