Module: Capybara::DSL
- Included in:
- Capybara
- Defined in:
- lib/capybara/dsl.rb
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Capybara::Session) page
Shortcut to accessing the current session.
-
- (Object) using_session(name, &block)
Shortcut to working in a different session.
-
- (Object) using_wait_time(seconds, &block)
Shortcut to using a different wait time.
Class Method Details
+ (Object) extended(base)
10 11 12 13 |
# File 'lib/capybara/dsl.rb', line 10 def self.extended(base) warn "extending the main object with Capybara::DSL is not recommended!" if base == TOPLEVEL_BINDING.eval("self") super end |
+ (Object) included(base)
5 6 7 8 |
# File 'lib/capybara/dsl.rb', line 5 def self.included(base) warn "including Capybara::DSL in the global scope is not recommended!" if base == Object super end |
Instance Method Details
- (Capybara::Session) page
Shortcut to accessing the current session.
class MyClass
include Capybara::DSL
def has_header?
page.has_css?('h1')
end
end
45 46 47 |
# File 'lib/capybara/dsl.rb', line 45 def page Capybara.current_session end |
- (Object) using_session(name, &block)
Shortcut to working in a different session.
19 20 21 |
# File 'lib/capybara/dsl.rb', line 19 def using_session(name, &block) Capybara.using_session(name, &block) end |
- (Object) using_wait_time(seconds, &block)
Shortcut to using a different wait time.
27 28 29 |
# File 'lib/capybara/dsl.rb', line 27 def using_wait_time(seconds, &block) Capybara.using_wait_time(seconds, &block) end |