module Capybara::DSL

Public Class Methods

extended(base) click to toggle source
Calls superclass method
# File lib/capybara/dsl.rb, line 12
def self.extended(base)
  warn "extending the main object with Capybara::DSL is not recommended!" if base == TOPLEVEL_BINDING.eval("self")
  super
end
included(base) click to toggle source
Calls superclass method
# File lib/capybara/dsl.rb, line 7
def self.included(base)
  warn "including Capybara::DSL in the global scope is not recommended!" if base == Object
  super
end

Public Instance Methods

page() click to toggle source

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

# File lib/capybara/dsl.rb, line 45
def page
  Capybara.current_session
end
using_session(name, &block) click to toggle source

Shortcut to working in a different session.

# File lib/capybara/dsl.rb, line 21
def using_session(name, &block)
  Capybara.using_session(name, &block)
end
using_wait_time(seconds, &block) click to toggle source

Shortcut to using a different wait time.

# File lib/capybara/dsl.rb, line 27
def using_wait_time(seconds, &block)
  page.using_wait_time(seconds, &block)
end