Add support for RSpec 3.5+ shared_context_metadata_behavior == :apply_to_host_groups
This commit is contained in:
parent
114ec10d12
commit
1a4cdbb7bd
|
@ -13,7 +13,7 @@ matrix:
|
||||||
- gemfile: Gemfile
|
- gemfile: Gemfile
|
||||||
rvm: 2.3.1
|
rvm: 2.3.1
|
||||||
env: WINDOW_TEST=true
|
env: WINDOW_TEST=true
|
||||||
- gemfile: Gemfile
|
- gemfile: gemfiles/Gemfile.rspec-34
|
||||||
rvm: 2.3.1
|
rvm: 2.3.1
|
||||||
env: CAPYBARA_CHROME=true
|
env: CAPYBARA_CHROME=true
|
||||||
- gemfile: gemfiles/Gemfile.ruby-19
|
- gemfile: gemfiles/Gemfile.ruby-19
|
||||||
|
|
|
@ -5,6 +5,7 @@ Release date: Unreleased
|
||||||
* Issue with modals present when closing the page using selenium - Issue #1696 [Jonas Nicklas, Thomas Walpole]
|
* Issue with modals present when closing the page using selenium - Issue #1696 [Jonas Nicklas, Thomas Walpole]
|
||||||
* Server errors raised in test code have the cause set to an explanatory exception
|
* Server errors raised in test code have the cause set to an explanatory exception
|
||||||
in rubies that support Exception#cause rather than a confusing ExpectationNotMet - Issue #1719 [Thomas Walpole]
|
in rubies that support Exception#cause rather than a confusing ExpectationNotMet - Issue #1719 [Thomas Walpole]
|
||||||
|
* background/given/given! RSoec aliases will work if RSpec config.shared_context_metadata_behavior == :apply_to_host_groups
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
* 'check', 'uncheck', and 'choose' will now click the associated label if the checkbox/radio button is not visible [Thomas Walpole]
|
* 'check', 'uncheck', and 'choose' will now click the associated label if the checkbox/radio button is not visible [Thomas Walpole]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
gem 'bundler', '~> 1.0'
|
gem 'bundler', '~> 1.1'
|
||||||
gemspec :path => '..'
|
gemspec :path => '..'
|
||||||
|
|
||||||
gem 'xpath', github: 'jnicklas/xpath'
|
gem 'xpath', github: 'jnicklas/xpath'
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
gem 'bundler', '~> 1.1'
|
||||||
|
gemspec :path => '..'
|
||||||
|
|
||||||
|
gem 'xpath', github: 'jnicklas/xpath'
|
||||||
|
gem 'rspec', '~>3.4.0'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
if RSpec::Core::Version::STRING.to_f >= 3.0
|
if RSpec::Core::Version::STRING.to_f >= 3.0
|
||||||
RSpec.shared_context "Capybara Features", :capybara_feature => true do
|
RSpec.shared_context "Capybara Features", capybara_feature: true do
|
||||||
instance_eval do
|
instance_eval do
|
||||||
alias background before
|
alias background before
|
||||||
alias given let
|
alias given let
|
||||||
|
@ -8,13 +8,20 @@ if RSpec::Core::Version::STRING.to_f >= 3.0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# ensure shared_context is included if default shared_context_metadata_behavior is changed
|
||||||
|
if RSpec::Core::Version::STRING.to_f >= 3.5
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.alias_example_group_to :feature, :capybara_feature => true, :type => :feature
|
config.include_context "Capybara Features", capybara_feature: true
|
||||||
config.alias_example_group_to :xfeature, :capybara_feature => true, :type => :feature, :skip => "Temporarily disabled with xfeature"
|
end
|
||||||
config.alias_example_group_to :ffeature, :capybara_feature => true, :type => :feature, :focus => true
|
end
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.alias_example_group_to :feature, capybara_feature: true, type: :feature
|
||||||
|
config.alias_example_group_to :xfeature, capybara_feature: true, type: :feature, skip: "Temporarily disabled with xfeature"
|
||||||
|
config.alias_example_group_to :ffeature, capybara_feature: true, type: :feature, focus: true
|
||||||
config.alias_example_to :scenario
|
config.alias_example_to :scenario
|
||||||
config.alias_example_to :xscenario, :skip => "Temporarily disabled with xscenario"
|
config.alias_example_to :xscenario, skip: "Temporarily disabled with xscenario"
|
||||||
config.alias_example_to :fscenario, :focus => true
|
config.alias_example_to :fscenario, focus: true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
module Capybara
|
module Capybara
|
||||||
|
|
|
@ -22,6 +22,8 @@ module Capybara
|
||||||
config.filter_run_excluding :requires => method(:filter).to_proc
|
config.filter_run_excluding :requires => method(:filter).to_proc
|
||||||
config.before { Capybara::SpecHelper.reset! }
|
config.before { Capybara::SpecHelper.reset! }
|
||||||
config.after { Capybara::SpecHelper.reset! }
|
config.after { Capybara::SpecHelper.reset! }
|
||||||
|
# Test in 3.5+ where metadata doesn't autotrigger shared context inclusion - will be only behavior in RSpec 4
|
||||||
|
config.shared_context_metadata_behavior = :apply_to_host_groups if RSpec::Core::Version::STRING.to_f >= 3.5
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset!
|
def reset!
|
||||||
|
|
Loading…
Reference in New Issue