Module: Capybara::DSL

Included in:
Capybara
Defined in:
lib/capybara/dsl.rb

Instance Method Summary collapse

Instance Method Details

#pageCapybara::Session

Shortcut to accessing the current session. This is useful when Capybara is included in a class or module.

class MyClass
  include Capybara::DSL

  def has_header?
    page.has_css?('h1')
  end
end


132
133
134
# File 'lib/capybara/dsl.rb', line 132

def page
  Capybara.current_session
end

#using_session(name, &block) ⇒ Object

Shortcut to working in a different session. This is useful when Capybara is included in a class or module.



113
114
115
# File 'lib/capybara/dsl.rb', line 113

def using_session(name, &block)
  Capybara.using_session(name, &block)
end