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

Returns:



154
155
156
# File 'lib/capybara/dsl.rb', line 154

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.



126
127
128
# File 'lib/capybara/dsl.rb', line 126

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

#using_wait_time(seconds, &block) ⇒ Object

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



135
136
137
# File 'lib/capybara/dsl.rb', line 135

def using_wait_time(seconds, &block)
  Capybara.using_wait_time(seconds, &block)
end