mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Don't depend on RSpec version check
This commit is contained in:
parent
ac86d0be92
commit
3634121afe
4 changed files with 79 additions and 83 deletions
|
@ -1,5 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
if defined?(::RSpec::Expectations::Version)
|
||||
module Capybara
|
||||
module RSpecMatchers
|
||||
module Compound
|
||||
|
@ -90,3 +91,4 @@ module Capybara
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -9,10 +9,8 @@ RSpec.shared_context "Capybara Features", capybara_feature: true do
|
|||
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|
|
||||
config.include_context "Capybara Features", capybara_feature: true
|
||||
end
|
||||
config.include_context "Capybara Features", capybara_feature: true if config.respond_to?(:include_context)
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'capybara/rspec/compound'
|
||||
|
||||
module Capybara
|
||||
module RSpecMatchers
|
||||
class Matcher
|
||||
if defined?(::RSpec::Expectations::Version)
|
||||
require 'capybara/rspec/compound'
|
||||
include ::Capybara::RSpecMatchers::Compound
|
||||
end
|
||||
include ::Capybara::RSpecMatchers::Compound if defined?(::Capybara::RSpecMatchers::Compound)
|
||||
|
||||
attr_reader :failure_message, :failure_message_when_negated
|
||||
|
||||
|
@ -199,10 +198,7 @@ module Capybara
|
|||
end
|
||||
|
||||
class NegatedMatcher
|
||||
if defined?(::RSpec::Expectations::Version)
|
||||
require 'capybara/rspec/compound'
|
||||
include ::Capybara::RSpecMatchers::Compound
|
||||
end
|
||||
include ::Capybara::RSpecMatchers::Compound if defined?(::Capybara::RSpecMatchers::Compound)
|
||||
|
||||
def initialize(matcher)
|
||||
@matcher = matcher
|
||||
|
|
|
@ -15,7 +15,7 @@ module Capybara
|
|||
config.before { 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
|
||||
config.shared_context_metadata_behavior = :apply_to_host_groups if config.respond_to?(:shared_context_metadata_behavior=)
|
||||
end
|
||||
|
||||
def reset!
|
||||
|
|
Loading…
Add table
Reference in a new issue