Class: Spec::Rails::Example::WebratExampleGroup

Inherits:
BaseWebratExampleGroup show all
Defined in:
lib/webrat_rspec_rails/webrat_example_group.rb

Instance Method Summary collapse

Methods inherited from BaseWebratExampleGroup

#html_escape

Instance Method Details

#current_pathObject



5
6
7
# File 'lib/webrat_rspec_rails/webrat_example_group.rb', line 5

def current_path
  current_url.blank? ? "" : URI.parse(current_url).path
end

#field_named(name, *field_types) ⇒ Object



17
18
19
# File 'lib/webrat_rspec_rails/webrat_example_group.rb', line 17

def field_named(name, *field_types)
  Webrat::Locators::FieldNamedLocator.new(webrat_session, current_dom, name, *field_types).locate
end


9
10
11
12
13
14
15
# File 'lib/webrat_rspec_rails/webrat_example_group.rb', line 9

def get_link(text_or_title_or_id)
  current_dom.css("a").find do |link|
    link.text == text_or_title_or_id ||
      link["title"] == text_or_title_or_id ||
      link["id"] == text_or_title_or_id
  end
end