/usr/lib/ruby/vendor_ruby/capybara/rspec/features.rb is in ruby-capybara 2.10.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # frozen_string_literal: true
if RSpec::Core::Version::STRING.to_f >= 3.0
RSpec.shared_context "Capybara Features", capybara_feature: true do
instance_eval do
alias background before
alias given let
alias given! let!
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|
config.include_context "Capybara Features", capybara_feature: true
end
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 :xscenario, skip: "Temporarily disabled with xscenario"
config.alias_example_to :fscenario, focus: true
end
else
module Capybara
module Features
def self.included(base)
base.instance_eval do
alias :background :before
alias :scenario :it
alias :xscenario :xit
alias :given :let
alias :given! :let!
alias :feature :describe
end
end
end
end
def self.feature(*args, &block)
options = if args.last.is_a?(Hash) then args.pop else {} end
options[:capybara_feature] = true
options[:type] = :feature
options[:caller] ||= caller
args.push(options)
#call describe on RSpec in case user has expose_dsl_globally set to false
RSpec.describe(*args, &block)
end
RSpec.configure do |config|
config.include(Capybara::Features, capybara_feature: true)
end
end
|