From f5ed57e0421141873e267dbddf2b88750c448a79 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 30 Nov 2008 20:09:41 -0500 Subject: [PATCH] Docs --- Rakefile | 7 ++++++- lib/webrat/core/configuration.rb | 11 ++++++++--- lib/webrat/core/elements/element.rb | 2 +- lib/webrat/core/locators/area_locator.rb | 2 +- lib/webrat/core/locators/button_locator.rb | 2 +- lib/webrat/core/locators/field_by_id_locator.rb | 2 +- lib/webrat/core/locators/field_labeled_locator.rb | 2 +- lib/webrat/core/locators/field_locator.rb | 2 +- lib/webrat/core/locators/field_named_locator.rb | 2 +- lib/webrat/core/locators/form_locator.rb | 2 +- lib/webrat/core/locators/label_locator.rb | 2 +- lib/webrat/core/locators/link_locator.rb | 2 +- lib/webrat/core/locators/locator.rb | 2 +- lib/webrat/core/locators/select_option_locator.rb | 2 +- lib/webrat/core/session.rb | 2 +- 15 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Rakefile b/Rakefile index ee59fe2..8bfce42 100644 --- a/Rakefile +++ b/Rakefile @@ -75,8 +75,13 @@ task :install_gem => [:clean, :package] do sh "sudo gem install --local #{gem}" end +desc "Delete generated RDoc" +task :clobber_docs do + FileUtils.rm_rf("doc") +end + desc "Generate RDoc" -task :docs do +task :docs => :clobber_docs do system "hanna --title 'Webrat #{Webrat::VERSION} API Documentation'" end diff --git a/lib/webrat/core/configuration.rb b/lib/webrat/core/configuration.rb index 13eb195..c18e655 100755 --- a/lib/webrat/core/configuration.rb +++ b/lib/webrat/core/configuration.rb @@ -7,16 +7,21 @@ module Webrat @@configuration = configuration end - def self.configuration + def self.configuration # :nodoc: @@configuration ||= Webrat::Configuration.new end - + + # Webrat can be configured using the Webrat.configure method. For example: + # + # Webrat.configure do |config| + # config.parse_with_nokogiri = false + # end class Configuration # Should XHTML be parsed with Nokogiri? Defaults to true, except on JRuby. When false, Hpricot and REXML are used attr_writer :parse_with_nokogiri # Webrat's mode, set automatically when requiring webrat/rails, webrat/merb, etc. - attr_accessor :mode + attr_accessor :mode # :nodoc: # Save and open pages with error status codes (500-599) in a browser? Defualts to true. attr_writer :open_error_files diff --git a/lib/webrat/core/elements/element.rb b/lib/webrat/core/elements/element.rb index b13cb00..6261d9f 100644 --- a/lib/webrat/core/elements/element.rb +++ b/lib/webrat/core/elements/element.rb @@ -1,6 +1,6 @@ module Webrat - class Element + class Element # :nodoc: def self.load_all(session, dom) Webrat::XML.xpath_search(dom, xpath_search).map do |element| diff --git a/lib/webrat/core/locators/area_locator.rb b/lib/webrat/core/locators/area_locator.rb index 9497939..dae3fa2 100644 --- a/lib/webrat/core/locators/area_locator.rb +++ b/lib/webrat/core/locators/area_locator.rb @@ -3,7 +3,7 @@ require "webrat/core/locators/locator" module Webrat module Locators - class AreaLocator < Locator + class AreaLocator < Locator # :nodoc: def locate Area.load(@session, area_element) diff --git a/lib/webrat/core/locators/button_locator.rb b/lib/webrat/core/locators/button_locator.rb index d2eaf1e..9e6adee 100644 --- a/lib/webrat/core/locators/button_locator.rb +++ b/lib/webrat/core/locators/button_locator.rb @@ -3,7 +3,7 @@ require "webrat/core/locators/locator" module Webrat module Locators - class ButtonLocator < Locator + class ButtonLocator < Locator # :nodoc: def locate ButtonField.load(@session, button_element) diff --git a/lib/webrat/core/locators/field_by_id_locator.rb b/lib/webrat/core/locators/field_by_id_locator.rb index 0a19620..a34084d 100644 --- a/lib/webrat/core/locators/field_by_id_locator.rb +++ b/lib/webrat/core/locators/field_by_id_locator.rb @@ -3,7 +3,7 @@ require "webrat/core/locators/locator" module Webrat module Locators - class FieldByIdLocator < Locator + class FieldByIdLocator < Locator # :nodoc: def locate Field.load(@session, field_element) diff --git a/lib/webrat/core/locators/field_labeled_locator.rb b/lib/webrat/core/locators/field_labeled_locator.rb index 1e51d54..6c485d2 100644 --- a/lib/webrat/core/locators/field_labeled_locator.rb +++ b/lib/webrat/core/locators/field_labeled_locator.rb @@ -4,7 +4,7 @@ require "webrat/core/locators/locator" module Webrat module Locators - class FieldLabeledLocator < Locator + class FieldLabeledLocator < Locator # :nodoc: def locate matching_labels.any? && matching_labels.first.field diff --git a/lib/webrat/core/locators/field_locator.rb b/lib/webrat/core/locators/field_locator.rb index 63156a4..83ea96b 100644 --- a/lib/webrat/core/locators/field_locator.rb +++ b/lib/webrat/core/locators/field_locator.rb @@ -3,7 +3,7 @@ require "webrat/core/locators/locator" module Webrat module Locators - class FieldLocator < Locator + class FieldLocator < Locator # :nodoc: def locate FieldByIdLocator.new(@session, @dom, @value).locate || diff --git a/lib/webrat/core/locators/field_named_locator.rb b/lib/webrat/core/locators/field_named_locator.rb index 641682a..2f2d592 100644 --- a/lib/webrat/core/locators/field_named_locator.rb +++ b/lib/webrat/core/locators/field_named_locator.rb @@ -3,7 +3,7 @@ require "webrat/core/locators/locator" module Webrat module Locators - class FieldNamedLocator < Locator + class FieldNamedLocator < Locator # :nodoc: def locate Field.load(@session, field_element) diff --git a/lib/webrat/core/locators/form_locator.rb b/lib/webrat/core/locators/form_locator.rb index 154979d..571e631 100644 --- a/lib/webrat/core/locators/form_locator.rb +++ b/lib/webrat/core/locators/form_locator.rb @@ -3,7 +3,7 @@ require "webrat/core/locators/locator" module Webrat module Locators - class FormLocator < Locator + class FormLocator < Locator # :nodoc: def locate Form.load(@session, form_element) diff --git a/lib/webrat/core/locators/label_locator.rb b/lib/webrat/core/locators/label_locator.rb index 72d55d3..633fa05 100644 --- a/lib/webrat/core/locators/label_locator.rb +++ b/lib/webrat/core/locators/label_locator.rb @@ -4,7 +4,7 @@ require "webrat/core/locators/locator" module Webrat module Locators - class LabelLocator < Locator + class LabelLocator < Locator # :nodoc: def locate Label.load(@session, label_element) diff --git a/lib/webrat/core/locators/link_locator.rb b/lib/webrat/core/locators/link_locator.rb index 9993b11..e1908cf 100644 --- a/lib/webrat/core/locators/link_locator.rb +++ b/lib/webrat/core/locators/link_locator.rb @@ -3,7 +3,7 @@ require "webrat/core/locators/locator" module Webrat module Locators - class LinkLocator < Locator + class LinkLocator < Locator # :nodoc: def locate Link.load(@session, link_element) diff --git a/lib/webrat/core/locators/locator.rb b/lib/webrat/core/locators/locator.rb index 46822be..66fe6ec 100644 --- a/lib/webrat/core/locators/locator.rb +++ b/lib/webrat/core/locators/locator.rb @@ -1,7 +1,7 @@ module Webrat module Locators - class Locator + class Locator # :nodoc: def initialize(session, dom, value, *field_types) @session = session diff --git a/lib/webrat/core/locators/select_option_locator.rb b/lib/webrat/core/locators/select_option_locator.rb index ae86ef9..b90ed7f 100644 --- a/lib/webrat/core/locators/select_option_locator.rb +++ b/lib/webrat/core/locators/select_option_locator.rb @@ -4,7 +4,7 @@ require "webrat/core/locators/locator" module Webrat module Locators - class SelectOptionLocator < Locator + class SelectOptionLocator < Locator # :nodoc: def initialize(session, dom, option_text, id_or_name_or_label) @session = session diff --git a/lib/webrat/core/session.rb b/lib/webrat/core/session.rb index bcdc687..71a2129 100644 --- a/lib/webrat/core/session.rb +++ b/lib/webrat/core/session.rb @@ -182,7 +182,7 @@ module Webrat end end - def rewrite_css_and_image_references(response_html) #:nodoc + def rewrite_css_and_image_references(response_html) # :nodoc: return response_html unless doc_root response_html.gsub(/"\/(stylesheets|images)/, doc_root + '/\1') end