2011-02-11 08:44:58 -05:00
|
|
|
module Capybara
|
|
|
|
module Features
|
|
|
|
def self.included(base)
|
|
|
|
base.instance_eval do
|
|
|
|
alias :background :before
|
|
|
|
alias :scenario :it
|
2012-10-30 09:43:41 -04:00
|
|
|
alias :xscenario :xit
|
2012-10-03 18:49:44 -04:00
|
|
|
alias :given :let
|
|
|
|
alias :given! :let!
|
2013-07-09 18:58:18 -04:00
|
|
|
alias :feature :describe
|
2011-02-11 08:44:58 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-07-09 18:58:18 -04:00
|
|
|
|
2011-03-12 06:38:48 -05:00
|
|
|
def self.feature(*args, &block)
|
2011-02-11 08:44:58 -05:00
|
|
|
options = if args.last.is_a?(Hash) then args.pop else {} end
|
|
|
|
options[:capybara_feature] = true
|
2012-09-07 14:17:38 -04:00
|
|
|
options[:type] = :feature
|
2011-03-13 09:31:04 -04:00
|
|
|
options[:caller] ||= caller
|
2011-02-11 08:44:58 -05:00
|
|
|
args.push(options)
|
|
|
|
|
2014-04-03 13:25:03 -04:00
|
|
|
#call describe on RSpec in case user has expose_dsl_globally set to false
|
|
|
|
RSpec.describe(*args, &block)
|
2011-02-11 08:44:58 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
RSpec.configuration.include Capybara::Features, :capybara_feature => true
|