forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rb] update guards to minimize unnecessary execution and allow messages
- Loading branch information
1 parent
6788463
commit 8ad5109
Showing
16 changed files
with
155 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# frozen_string_literal: true | ||
|
||
# Licensed to the Software Freedom Conservancy (SFC) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The SFC licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
require_relative 'spec_helper' | ||
|
||
module Selenium | ||
module WebDriver | ||
module SpecSupport | ||
describe Guards, exclusive: {driver: :chrome} do | ||
describe '#exclude' do | ||
it 'ignores an unrecognized guard parameter', invalid: {browser: :chrome} do | ||
# pass | ||
end | ||
|
||
it 'skips without running', exclude: {browser: :chrome} do | ||
puts "This code will not get executed" | ||
end | ||
end | ||
|
||
describe '#exclusive' do | ||
it 'skips without running if it does not match', exclusive: {browser: :not_chrome} do | ||
puts "This code will not get executed" | ||
end | ||
|
||
it 'does not guard if it does match', exclusive: {browser: :chrome} do | ||
# pass | ||
end | ||
end | ||
|
||
describe '#only' do | ||
it 'guards when value does not match', only: {browser: :not_chrome} do | ||
fail | ||
end | ||
|
||
it 'does not guard when value matches', only: {browser: :chrome} do | ||
# pass | ||
end | ||
end | ||
|
||
describe '#except' do | ||
it 'guards when value matches and test fails', except: {browser: :chrome} do | ||
fail | ||
end | ||
|
||
it 'does not guard when value does not match and test passes', except: {browser: :not_chrome} do | ||
# pass | ||
end | ||
end | ||
|
||
context 'when multiple guards' do | ||
it 'guards if neither only nor except match and test fails', only: {browser: :not_chrome}, | ||
except: {browser: :not_chrome} do | ||
fail | ||
end | ||
|
||
it 'guards if both only and except match', only: {browser: :chrome}, | ||
except: {browser: :chrome} do | ||
fail | ||
end | ||
|
||
it 'guards if except matches and only does not', only: {browser: :not_chrome}, | ||
except: {browser: :chrome} do | ||
fail | ||
end | ||
|
||
it 'does not guard if only matches and except does not', only: {browser: :chrome}, | ||
except: {browser: :not_chrome} do | ||
# pass | ||
end | ||
end | ||
|
||
context 'when array of hashes' do | ||
it 'guards if any Hash value is satisfied', only: [{browser: :chrome}, {browser: :not_chrome}] do | ||
fail | ||
end | ||
end | ||
|
||
context 'guard messages on failing tests' do | ||
it 'gives correct message with single only excludes', except: [{browser: :chrome, message: 'bug1'}, | ||
{browser: :not_chrome, message: 'bug2'}] do | ||
fail | ||
end | ||
end | ||
end | ||
end # SpecSupport | ||
end # WebDriver | ||
end # Selenium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters