Docs
This commit is contained in:
parent
52aa8e2bba
commit
f5ed57e042
7
Rakefile
7
Rakefile
@ -75,8 +75,13 @@ task :install_gem => [:clean, :package] do
|
|||||||
sh "sudo gem install --local #{gem}"
|
sh "sudo gem install --local #{gem}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Delete generated RDoc"
|
||||||
|
task :clobber_docs do
|
||||||
|
FileUtils.rm_rf("doc")
|
||||||
|
end
|
||||||
|
|
||||||
desc "Generate RDoc"
|
desc "Generate RDoc"
|
||||||
task :docs do
|
task :docs => :clobber_docs do
|
||||||
system "hanna --title 'Webrat #{Webrat::VERSION} API Documentation'"
|
system "hanna --title 'Webrat #{Webrat::VERSION} API Documentation'"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -7,16 +7,21 @@ module Webrat
|
|||||||
@@configuration = configuration
|
@@configuration = configuration
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.configuration
|
def self.configuration # :nodoc:
|
||||||
@@configuration ||= Webrat::Configuration.new
|
@@configuration ||= Webrat::Configuration.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Webrat can be configured using the Webrat.configure method. For example:
|
||||||
|
#
|
||||||
|
# Webrat.configure do |config|
|
||||||
|
# config.parse_with_nokogiri = false
|
||||||
|
# end
|
||||||
class Configuration
|
class Configuration
|
||||||
# Should XHTML be parsed with Nokogiri? Defaults to true, except on JRuby. When false, Hpricot and REXML are used
|
# Should XHTML be parsed with Nokogiri? Defaults to true, except on JRuby. When false, Hpricot and REXML are used
|
||||||
attr_writer :parse_with_nokogiri
|
attr_writer :parse_with_nokogiri
|
||||||
|
|
||||||
# Webrat's mode, set automatically when requiring webrat/rails, webrat/merb, etc.
|
# 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.
|
# Save and open pages with error status codes (500-599) in a browser? Defualts to true.
|
||||||
attr_writer :open_error_files
|
attr_writer :open_error_files
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module Webrat
|
module Webrat
|
||||||
|
|
||||||
class Element
|
class Element # :nodoc:
|
||||||
|
|
||||||
def self.load_all(session, dom)
|
def self.load_all(session, dom)
|
||||||
Webrat::XML.xpath_search(dom, xpath_search).map do |element|
|
Webrat::XML.xpath_search(dom, xpath_search).map do |element|
|
||||||
|
@ -3,7 +3,7 @@ require "webrat/core/locators/locator"
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class AreaLocator < Locator
|
class AreaLocator < Locator # :nodoc:
|
||||||
|
|
||||||
def locate
|
def locate
|
||||||
Area.load(@session, area_element)
|
Area.load(@session, area_element)
|
||||||
|
@ -3,7 +3,7 @@ require "webrat/core/locators/locator"
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class ButtonLocator < Locator
|
class ButtonLocator < Locator # :nodoc:
|
||||||
|
|
||||||
def locate
|
def locate
|
||||||
ButtonField.load(@session, button_element)
|
ButtonField.load(@session, button_element)
|
||||||
|
@ -3,7 +3,7 @@ require "webrat/core/locators/locator"
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class FieldByIdLocator < Locator
|
class FieldByIdLocator < Locator # :nodoc:
|
||||||
|
|
||||||
def locate
|
def locate
|
||||||
Field.load(@session, field_element)
|
Field.load(@session, field_element)
|
||||||
|
@ -4,7 +4,7 @@ require "webrat/core/locators/locator"
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class FieldLabeledLocator < Locator
|
class FieldLabeledLocator < Locator # :nodoc:
|
||||||
|
|
||||||
def locate
|
def locate
|
||||||
matching_labels.any? && matching_labels.first.field
|
matching_labels.any? && matching_labels.first.field
|
||||||
|
@ -3,7 +3,7 @@ require "webrat/core/locators/locator"
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class FieldLocator < Locator
|
class FieldLocator < Locator # :nodoc:
|
||||||
|
|
||||||
def locate
|
def locate
|
||||||
FieldByIdLocator.new(@session, @dom, @value).locate ||
|
FieldByIdLocator.new(@session, @dom, @value).locate ||
|
||||||
|
@ -3,7 +3,7 @@ require "webrat/core/locators/locator"
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class FieldNamedLocator < Locator
|
class FieldNamedLocator < Locator # :nodoc:
|
||||||
|
|
||||||
def locate
|
def locate
|
||||||
Field.load(@session, field_element)
|
Field.load(@session, field_element)
|
||||||
|
@ -3,7 +3,7 @@ require "webrat/core/locators/locator"
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class FormLocator < Locator
|
class FormLocator < Locator # :nodoc:
|
||||||
|
|
||||||
def locate
|
def locate
|
||||||
Form.load(@session, form_element)
|
Form.load(@session, form_element)
|
||||||
|
@ -4,7 +4,7 @@ require "webrat/core/locators/locator"
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class LabelLocator < Locator
|
class LabelLocator < Locator # :nodoc:
|
||||||
|
|
||||||
def locate
|
def locate
|
||||||
Label.load(@session, label_element)
|
Label.load(@session, label_element)
|
||||||
|
@ -3,7 +3,7 @@ require "webrat/core/locators/locator"
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class LinkLocator < Locator
|
class LinkLocator < Locator # :nodoc:
|
||||||
|
|
||||||
def locate
|
def locate
|
||||||
Link.load(@session, link_element)
|
Link.load(@session, link_element)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class Locator
|
class Locator # :nodoc:
|
||||||
|
|
||||||
def initialize(session, dom, value, *field_types)
|
def initialize(session, dom, value, *field_types)
|
||||||
@session = session
|
@session = session
|
||||||
|
@ -4,7 +4,7 @@ require "webrat/core/locators/locator"
|
|||||||
module Webrat
|
module Webrat
|
||||||
module Locators
|
module Locators
|
||||||
|
|
||||||
class SelectOptionLocator < Locator
|
class SelectOptionLocator < Locator # :nodoc:
|
||||||
|
|
||||||
def initialize(session, dom, option_text, id_or_name_or_label)
|
def initialize(session, dom, option_text, id_or_name_or_label)
|
||||||
@session = session
|
@session = session
|
||||||
|
@ -182,7 +182,7 @@ module Webrat
|
|||||||
end
|
end
|
||||||
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
|
return response_html unless doc_root
|
||||||
response_html.gsub(/"\/(stylesheets|images)/, doc_root + '/\1')
|
response_html.gsub(/"\/(stylesheets|images)/, doc_root + '/\1')
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user