/usr/lib/ruby/vendor_ruby/capybara/dsl.rb is in ruby-capybara 2.2.1-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 57 | require 'capybara'
module Capybara
module DSL
def self.included(base)
warn "including Capybara::DSL in the global scope is not recommended!" if base == Object
super
end
def self.extended(base)
warn "extending the main object with Capybara::DSL is not recommended!" if base == TOPLEVEL_BINDING.eval("self")
super
end
##
#
# Shortcut to working in a different session.
#
def using_session(name, &block)
Capybara.using_session(name, &block)
end
##
#
# Shortcut to using a different wait time.
#
def using_wait_time(seconds, &block)
Capybara.using_wait_time(seconds, &block)
end
##
#
# Shortcut to accessing the current session.
#
# class MyClass
# include Capybara::DSL
#
# def has_header?
# page.has_css?('h1')
# end
# end
#
# @return [Capybara::Session] The current session object
#
def page
Capybara.current_session
end
Session::DSL_METHODS.each do |method|
define_method method do |*args, &block|
page.send method, *args, &block
end
end
end
extend(Capybara::DSL)
end
|