2014-06-12 19:45:16 -04:00
|
|
|
if RSpec::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
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.alias_example_group_to :feature, :capybara_feature => true, :type => :feature
|
|
|
|
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
|
2011-02-11 08:44:58 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-07-09 18:58:18 -04:00
|
|
|
|
2014-06-12 19:45:16 -04:00
|
|
|
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)
|
2011-02-11 08:44:58 -05:00
|
|
|
|
2014-06-12 19:45:16 -04:00
|
|
|
#call describe on RSpec in case user has expose_dsl_globally set to false
|
|
|
|
RSpec.describe(*args, &block)
|
|
|
|
end
|
2011-02-11 08:44:58 -05:00
|
|
|
|
2014-06-12 19:45:16 -04:00
|
|
|
RSpec.configuration.include Capybara::Features, :capybara_feature => true
|
|
|
|
end
|