Module: Webrat

Defined in:
lib/webrat/core/xml.rb,
lib/webrat.rb,
lib/webrat/selenium.rb,
lib/webrat/core/mime.rb,
lib/webrat/core/scope.rb,
lib/webrat/core/logging.rb,
lib/webrat/core/methods.rb,
lib/webrat/core/session.rb,
lib/webrat/adapters/merb.rb,
lib/webrat/adapters/rack.rb,
lib/webrat/core/locators.rb,
lib/webrat/adapters/rails.rb,
lib/webrat/adapters/sinatra.rb,
lib/webrat/adapters/mechanize.rb,
lib/webrat/core/configuration.rb,
lib/webrat/core/elements/area.rb,
lib/webrat/core/elements/form.rb,
lib/webrat/core/elements/link.rb,
lib/webrat/core/elements/field.rb,
lib/webrat/core/elements/label.rb,
lib/webrat/core/elements/element.rb,
lib/webrat/core/locators/locator.rb,
lib/webrat/core/matchers/have_tag.rb,
lib/webrat/core/save_and_open_page.rb,
lib/webrat/selenium/silence_stream.rb,
lib/webrat/core/matchers/have_xpath.rb,
lib/webrat/selenium/selenium_session.rb,
lib/webrat/core/locators/area_locator.rb,
lib/webrat/core/locators/form_locator.rb,
lib/webrat/core/locators/link_locator.rb,
lib/webrat/core/matchers/have_content.rb,
lib/webrat/selenium/matchers/have_tag.rb,
lib/webrat/core/elements/select_option.rb,
lib/webrat/core/locators/field_locator.rb,
lib/webrat/core/locators/label_locator.rb,
lib/webrat/core/matchers/have_selector.rb,
lib/webrat/selenium/selenium_rc_server.rb,
lib/webrat/core/locators/button_locator.rb,
lib/webrat/selenium/matchers/have_xpath.rb,
lib/webrat/selenium/matchers/have_content.rb,
lib/webrat/selenium/matchers/have_selector.rb,
lib/webrat/core/locators/field_by_id_locator.rb,
lib/webrat/core/locators/field_named_locator.rb,
lib/webrat/selenium/application_servers/base.rb,
lib/webrat/selenium/application_servers/merb.rb,
lib/webrat/selenium/application_servers/rails.rb,
lib/webrat/core/locators/field_labeled_locator.rb,
lib/webrat/core/locators/select_option_locator.rb,
lib/webrat/selenium/application_server_factory.rb,
lib/webrat/selenium/application_servers/sinatra.rb,
lib/webrat/selenium/application_servers/external.rb

Overview

:nodoc:

Defined Under Namespace

Modules: HaveTagMatcher, Locators, Logging, MIME, Matchers, Methods, SaveAndOpenPage, Selenium, XML Classes: Area, ButtonField, CheckboxField, Configuration, DisabledFieldError, Element, Field, FileField, Form, HiddenField, InfiniteRedirectError, Label, Link, MechanizeAdapter, MerbAdapter, MultipleSelectField, NotFoundError, PageLoadError, PasswordField, RackAdapter, RadioField, RailsAdapter, ResetField, Scope, SelectField, SelectOption, SeleniumResponse, SeleniumSession, Session, SinatraAdapter, TextField, TextareaField, TimeoutError, WebratError

Constant Summary collapse

VERSION =
"0.7.2.pre"

Class Method Summary collapse

Class Method Details

.adapter_classObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/webrat/core/session.rb', line 23

def self.adapter_class
  case Webrat.configuration.mode
  when :rails
    RailsAdapter
  when :merb
    MerbAdapter
  when :rack
    RackAdapter
  when :rack_test
    warn("The :rack_test mode is deprecated. Please use :rack instead")
    require "webrat/rack"
    RackAdapter
  when :sinatra
    warn("The :sinatra mode is deprecated. Please use :rack instead")
    SinatraAdapter
  when :mechanize
    MechanizeAdapter
  else
    raise WebratError.new(<<-STR)
Unknown Webrat mode: #{Webrat.configuration.mode.inspect}

Please ensure you have a Webrat configuration block that specifies a mode
in your test_helper.rb, spec_helper.rb, or env.rb (for Cucumber).

This configure block supercedes the need to require "webrat/<framework>".

For example:

Webrat.configure do |config|
  config.mode = :rails
end
    STR
  end
end

.configurationObject

:nodoc:



13
14
15
# File 'lib/webrat/core/configuration.rb', line 13

def self.configuration # :nodoc:
  @@configuration ||= Webrat::Configuration.new
end

.configure(configuration = Webrat.configuration) {|configuration| ... } ⇒ Object

Configures Webrat. If this is not done, Webrat will be created with all of the default settings.

Yields:



8
9
10
11
# File 'lib/webrat/core/configuration.rb', line 8

def self.configure(configuration = Webrat.configuration)
  yield configuration if block_given?
  @@configuration = configuration
end

.session_classObject



15
16
17
18
19
20
21
# File 'lib/webrat/core/session.rb', line 15

def self.session_class
  if Webrat.configuration.mode == :selenium
    SeleniumSession
  else
    Session
  end
end