From 2d867451ca268c18e85657e85b1b762fecd73373 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Fri, 7 Nov 2008 12:13:41 -0500 Subject: [PATCH] Cleaning up rdoc to only show public APIs --- Rakefile | 12 ++++++++ lib/webrat.rb | 2 +- lib/webrat/core/area.rb | 2 +- lib/webrat/core/field.rb | 22 +++++++------- lib/webrat/core/flunk.rb | 2 +- lib/webrat/core/form.rb | 2 +- lib/webrat/core/label.rb | 2 +- lib/webrat/core/link.rb | 2 +- lib/webrat/core/locators.rb | 14 ++++----- lib/webrat/core/logging.rb | 2 +- lib/webrat/core/matchers/have_content.rb | 2 +- lib/webrat/core/matchers/have_selector.rb | 2 +- lib/webrat/core/matchers/have_tag.rb | 2 +- lib/webrat/core/matchers/have_xpath.rb | 2 +- lib/webrat/core/methods.rb | 2 +- lib/webrat/core/nokogiri.rb | 8 ++--- lib/webrat/core/scope.rb | 22 +++++++------- lib/webrat/core/select_option.rb | 2 +- lib/webrat/core/session.rb | 30 +++++++++---------- lib/webrat/core_extensions/blank.rb | 2 +- lib/webrat/core_extensions/deprecate.rb | 2 +- lib/webrat/core_extensions/detect_mapped.rb | 2 +- .../hash_with_indifferent_access.rb | 4 +-- lib/webrat/core_extensions/meta_class.rb | 2 +- lib/webrat/core_extensions/nil_to_param.rb | 2 +- lib/webrat/mechanize.rb | 2 +- lib/webrat/merb.rb | 6 ++-- lib/webrat/rack.rb | 4 +-- lib/webrat/rails.rb | 12 ++++---- lib/webrat/rails/redirect_actions.rb | 2 +- lib/webrat/selenium/selenium_session.rb | 14 ++++----- lib/webrat/sinatra.rb | 2 +- spec/webrat/rails/attaches_file_spec.rb | 12 ++++---- 33 files changed, 107 insertions(+), 95 deletions(-) diff --git a/Rakefile b/Rakefile index d10a280..886c130 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,6 @@ require 'rubygems' require "rake/gempackagetask" +require 'rake/rdoctask' require "rake/clean" require 'spec' require 'spec/rake/spectask' @@ -75,3 +76,14 @@ task :install_gem => [:clean, :package] do gem = Dir['pkg/*.gem'].first sh "sudo gem install --local #{gem}" end + +Rake::RDocTask.new(:docs) do |rd| + rd.main = "README.txt" + rd.rdoc_dir = 'doc' + files = spec.files.grep(/^(lib|bin|ext)|txt$/) + files -= ["TODO.txt"] + files -= files.grep(/\.js$/) + rd.rdoc_files = files.uniq + title = "webrat-#{Webrat::VERSION} Documentation" + rd.options << "-t #{title}" +end \ No newline at end of file diff --git a/lib/webrat.rb b/lib/webrat.rb index 6b92ab8..94bc04b 100644 --- a/lib/webrat.rb +++ b/lib/webrat.rb @@ -5,7 +5,7 @@ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.i module Webrat VERSION = '0.3.0' - def self.root + def self.root #:nodoc: defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root end end diff --git a/lib/webrat/core/area.rb b/lib/webrat/core/area.rb index 3812654..b24283e 100644 --- a/lib/webrat/core/area.rb +++ b/lib/webrat/core/area.rb @@ -1,5 +1,5 @@ module Webrat - class Area + class Area #:nodoc: def initialize(session, element) @session = session diff --git a/lib/webrat/core/field.rb b/lib/webrat/core/field.rb index 9cf0286..4649639 100644 --- a/lib/webrat/core/field.rb +++ b/lib/webrat/core/field.rb @@ -3,7 +3,7 @@ require "webrat/core_extensions/blank" require "webrat/core_extensions/nil_to_param" module Webrat - class Field + class Field #:nodoc: def self.class_for_element(element) if element.name == "input" @@ -138,7 +138,7 @@ module Webrat end end - class ButtonField < Field + class ButtonField < Field #:nodoc: def matches_text?(text) @element.inner_html =~ /#{Regexp.escape(text.to_s)}/i @@ -165,7 +165,7 @@ module Webrat end - class HiddenField < Field + class HiddenField < Field #:nodoc: def to_param if collection_name? @@ -189,7 +189,7 @@ module Webrat end - class CheckboxField < Field + class CheckboxField < Field #:nodoc: def to_param return nil if @value.nil? @@ -222,10 +222,10 @@ module Webrat end - class PasswordField < Field + class PasswordField < Field #:nodoc: end - class RadioField < Field + class RadioField < Field #:nodoc: def to_param return nil if @value.nil? @@ -257,7 +257,7 @@ module Webrat end - class TextareaField < Field + class TextareaField < Field #:nodoc: protected @@ -267,7 +267,7 @@ module Webrat end - class FileField < Field + class FileField < Field #:nodoc: attr_accessor :content_type @@ -296,13 +296,13 @@ module Webrat end - class TextField < Field + class TextField < Field #:nodoc: end - class ResetField < Field + class ResetField < Field #:nodoc: end - class SelectField < Field + class SelectField < Field #:nodoc: def find_option(text) options.detect { |o| o.matches_text?(text) } diff --git a/lib/webrat/core/flunk.rb b/lib/webrat/core/flunk.rb index 183aebe..992070d 100644 --- a/lib/webrat/core/flunk.rb +++ b/lib/webrat/core/flunk.rb @@ -1,6 +1,6 @@ module Flunk - def flunk(message) + def flunk(message) #:nodoc: raise message end diff --git a/lib/webrat/core/form.rb b/lib/webrat/core/form.rb index 4ab2182..4e6585f 100644 --- a/lib/webrat/core/form.rb +++ b/lib/webrat/core/form.rb @@ -2,7 +2,7 @@ require "webrat/core/field" require "webrat/core_extensions/blank" module Webrat - class Form + class Form #:nodoc: attr_reader :element def initialize(session, element) diff --git a/lib/webrat/core/label.rb b/lib/webrat/core/label.rb index 87d98cd..4f3d77d 100644 --- a/lib/webrat/core/label.rb +++ b/lib/webrat/core/label.rb @@ -1,5 +1,5 @@ module Webrat - class Label + class Label #:nodoc: def initialize(field, element) @field = field diff --git a/lib/webrat/core/link.rb b/lib/webrat/core/link.rb index ee828a3..bc13655 100644 --- a/lib/webrat/core/link.rb +++ b/lib/webrat/core/link.rb @@ -1,7 +1,7 @@ require "webrat/core_extensions/blank" module Webrat - class Link + class Link #:nodoc: def initialize(session, element) @session = session diff --git a/lib/webrat/core/locators.rb b/lib/webrat/core/locators.rb index 0edf4c7..8c65926 100644 --- a/lib/webrat/core/locators.rb +++ b/lib/webrat/core/locators.rb @@ -26,25 +26,25 @@ module Webrat flunk("Could not find field with id #{id.inspect}") end - def find_field_labeled(label, *field_types) + def find_field_labeled(label, *field_types) #:nodoc: forms.detect_mapped do |form| form.field_labeled(label, *field_types) end end - def find_field_named(name, *field_types) + def find_field_named(name, *field_types) #:nodoc: forms.detect_mapped do |form| form.field_named(name, *field_types) end end - def find_field_with_id(id, *field_types) + def find_field_with_id(id, *field_types) #:nodoc: forms.detect_mapped do |form| form.field_with_id(id, *field_types) end end - def find_select_option(option_text, id_or_name_or_label) + def find_select_option(option_text, id_or_name_or_label) #:nodoc: if id_or_name_or_label field = field(id_or_name_or_label, SelectField) return field.find_option(option_text) @@ -59,7 +59,7 @@ module Webrat flunk("Could not find option #{option_text.inspect}") end - def find_button(value) + def find_button(value) #:nodoc: button = forms.detect_mapped do |form| form.find_button(value) end @@ -71,12 +71,12 @@ module Webrat end end - def find_area(area_name) + def find_area(area_name) #:nodoc: areas.detect { |area| area.matches_text?(area_name) } || flunk("Could not find area with name #{area_name}") end - def find_link(text) + def find_link(text) #:nodoc: matching_links = links.select do |possible_link| possible_link.matches_text?(text) end diff --git a/lib/webrat/core/logging.rb b/lib/webrat/core/logging.rb index 8f03055..7273455 100644 --- a/lib/webrat/core/logging.rb +++ b/lib/webrat/core/logging.rb @@ -1,5 +1,5 @@ module Webrat - module Logging + module Logging #:nodoc: def warn_log(message) # :nodoc: return unless logger diff --git a/lib/webrat/core/matchers/have_content.rb b/lib/webrat/core/matchers/have_content.rb index faa81df..d2e8c2c 100644 --- a/lib/webrat/core/matchers/have_content.rb +++ b/lib/webrat/core/matchers/have_content.rb @@ -1,7 +1,7 @@ module Webrat module Matchers - class HasContent + class HasContent #:nodoc: def initialize(content) @content = content end diff --git a/lib/webrat/core/matchers/have_selector.rb b/lib/webrat/core/matchers/have_selector.rb index 3611041..dd6fff9 100644 --- a/lib/webrat/core/matchers/have_selector.rb +++ b/lib/webrat/core/matchers/have_selector.rb @@ -1,7 +1,7 @@ module Webrat module Matchers - class HaveSelector < HaveXpath + class HaveSelector < HaveXpath #:nodoc: # ==== Returns # String:: The failure message. diff --git a/lib/webrat/core/matchers/have_tag.rb b/lib/webrat/core/matchers/have_tag.rb index 100b99a..752c85d 100644 --- a/lib/webrat/core/matchers/have_tag.rb +++ b/lib/webrat/core/matchers/have_tag.rb @@ -2,7 +2,7 @@ module Webrat module HaveTagMatcher - class HaveTag < ::Webrat::Matchers::HaveSelector + class HaveTag < ::Webrat::Matchers::HaveSelector #:nodoc: # ==== Returns # String:: The failure message. diff --git a/lib/webrat/core/matchers/have_xpath.rb b/lib/webrat/core/matchers/have_xpath.rb index b949e54..4e9c238 100644 --- a/lib/webrat/core/matchers/have_xpath.rb +++ b/lib/webrat/core/matchers/have_xpath.rb @@ -1,7 +1,7 @@ module Webrat module Matchers - class HaveXpath + class HaveXpath #:nodoc: def initialize(expected, &block) @expected = expected @block = block diff --git a/lib/webrat/core/methods.rb b/lib/webrat/core/methods.rb index 2326b25..ad9e0db 100644 --- a/lib/webrat/core/methods.rb +++ b/lib/webrat/core/methods.rb @@ -1,5 +1,5 @@ module Webrat - module Methods + module Methods #:nodoc: def self.delegate_to_session(*meths) meths.each do |meth| diff --git a/lib/webrat/core/nokogiri.rb b/lib/webrat/core/nokogiri.rb index 4994bb0..c9d7deb 100644 --- a/lib/webrat/core/nokogiri.rb +++ b/lib/webrat/core/nokogiri.rb @@ -2,7 +2,7 @@ require "webrat/core_extensions/meta_class" module Webrat - def self.nokogiri_document(stringlike) + def self.nokogiri_document(stringlike) #:nodoc: return stringlike.dom if stringlike.respond_to?(:dom) if stringlike === Nokogiri::HTML::Document || stringlike === Nokogiri::XML::NodeSet @@ -16,7 +16,7 @@ module Webrat end end - def self.define_dom_method(object, dom) + def self.define_dom_method(object, dom) #:nodoc: object.meta_class.send(:define_method, :dom) do dom end @@ -29,11 +29,11 @@ module Nokogiri module CSS class XPathVisitor - def visit_pseudo_class_text(node) + def visit_pseudo_class_text(node) #:nodoc: "@type='text'" end - def visit_pseudo_class_password(node) + def visit_pseudo_class_password(node) #:nodoc: "@type='password'" end diff --git a/lib/webrat/core/scope.rb b/lib/webrat/core/scope.rb index c627042..adf1d6a 100644 --- a/lib/webrat/core/scope.rb +++ b/lib/webrat/core/scope.rb @@ -8,21 +8,21 @@ module Webrat include Flunk include Locators - def self.from_page(session, response, response_body) + def self.from_page(session, response, response_body) #:nodoc: new(session) do @response = response @response_body = response_body end end - def self.from_scope(session, scope, selector) + def self.from_scope(session, scope, selector) #:nodoc: new(session) do @scope = scope @selector = selector end end - def initialize(session, &block) + def initialize(session, &block) #:nodoc: @session = session instance_eval(&block) if block_given? end @@ -100,11 +100,11 @@ module Webrat # Example: # attaches_file "Resume", "/path/to/the/resume.txt" # attaches_file "Photo", "/path/to/the/image.png", "image/png" - def attaches_file(field_locator, path, content_type = nil) + def attach_file(field_locator, path, content_type = nil) locate_field(field_locator, FileField).set(path, content_type) end - alias_method :attach_file, :attaches_file + alias_method :attaches_file, :attach_file def click_area(area_name) find_area(area_name).click @@ -165,18 +165,18 @@ module Webrat protected - def page_dom + def page_dom #:nodoc: return @response.dom if @response.respond_to?(:dom) dom = Webrat.nokogiri_document(@response_body) Webrat.define_dom_method(@response, dom) return dom end - def scoped_dom + def scoped_dom #:nodoc: Webrat.nokogiri_document(@scope.dom.search(@selector).first.to_html) end - def locate_field(field_locator, *field_types) + def locate_field(field_locator, *field_types) #:nodoc: if field_locator.is_a?(Field) field_locator else @@ -184,19 +184,19 @@ module Webrat end end - def areas + def areas #:nodoc: dom.search("area").map do |element| Area.new(@session, element) end end - def links + def links #:nodoc: dom.search("a[@href]").map do |link_element| Link.new(@session, link_element) end end - def forms + def forms #:nodoc: return @forms if @forms @forms = dom.search("form").map do |form_element| diff --git a/lib/webrat/core/select_option.rb b/lib/webrat/core/select_option.rb index ffb77cf..461c8ae 100644 --- a/lib/webrat/core/select_option.rb +++ b/lib/webrat/core/select_option.rb @@ -1,5 +1,5 @@ module Webrat - class SelectOption + class SelectOption #:nodoc: def initialize(select, element) @select = select diff --git a/lib/webrat/core/session.rb b/lib/webrat/core/session.rb index ff0ae22..32a5840 100644 --- a/lib/webrat/core/session.rb +++ b/lib/webrat/core/session.rb @@ -11,7 +11,7 @@ module Webrat attr_reader :current_url - def initialize + def initialize #:nodoc: @http_method = :get @data = {} @default_headers = {} @@ -35,12 +35,12 @@ module Webrat open_in_browser(filename) end - def current_dom + def current_dom #:nodoc: current_scope.dom end # For backwards compatibility -- removing in 1.0 - def current_page + def current_page #:nodoc: page = OpenStruct.new page.url = @current_url page.http_method = @http_method @@ -48,11 +48,11 @@ module Webrat page end - def doc_root + def doc_root #:nodoc: nil end - def saved_page_dir + def saved_page_dir #:nodoc: File.expand_path(".") end @@ -69,11 +69,11 @@ module Webrat header('HTTP_AUTHORIZATION', "Basic #{encoded_login}") end - def headers + def headers #:nodoc: @default_headers.dup.merge(@custom_headers.dup) end - def request_page(url, http_method, data) + def request_page(url, http_method, data) #:nodoc: h = headers h['HTTP_REFERER'] = @current_url if @current_url @@ -96,15 +96,15 @@ module Webrat return response end - def success_code? + def success_code? #:nodoc: (200..499).include?(response_code) end - def exception_caught? + def exception_caught? #:nodoc: response_body =~ /Exception caught/ end - def current_scope + def current_scope #:nodoc: scopes.last || page_scope end @@ -150,25 +150,25 @@ module Webrat alias_method :visits, :visit - def open_in_browser(path) # :nodoc + def open_in_browser(path) #:nodoc `open #{path}` 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 # Subclasses can override this to show error messages without html - def formatted_error + def formatted_error #:nodoc: response_body end - def scopes + def scopes #:nodoc: @_scopes ||= [] end - def page_scope + def page_scope #:nodoc: @_page_scope ||= Scope.from_page(self, response, response_body) end diff --git a/lib/webrat/core_extensions/blank.rb b/lib/webrat/core_extensions/blank.rb index 4f8dc4e..da83b40 100644 --- a/lib/webrat/core_extensions/blank.rb +++ b/lib/webrat/core_extensions/blank.rb @@ -1,4 +1,4 @@ -class Object +class Object #:nodoc: # An object is blank if it's false, empty, or a whitespace string. # For example, "", " ", +nil+, [], and {} are blank. # diff --git a/lib/webrat/core_extensions/deprecate.rb b/lib/webrat/core_extensions/deprecate.rb index d80f62e..a7ec5ff 100644 --- a/lib/webrat/core_extensions/deprecate.rb +++ b/lib/webrat/core_extensions/deprecate.rb @@ -1,4 +1,4 @@ -class Module +class Module #:nodoc: def deprecate(old_method_name, new_method_name) define_method old_method_name do |*args| warn "#{old_method_name} is deprecated. Use #{new_method_name} instead." diff --git a/lib/webrat/core_extensions/detect_mapped.rb b/lib/webrat/core_extensions/detect_mapped.rb index e7a5a66..d860558 100644 --- a/lib/webrat/core_extensions/detect_mapped.rb +++ b/lib/webrat/core_extensions/detect_mapped.rb @@ -1,4 +1,4 @@ -class Array +class Array #:nodoc: def detect_mapped each do |element| diff --git a/lib/webrat/core_extensions/hash_with_indifferent_access.rb b/lib/webrat/core_extensions/hash_with_indifferent_access.rb index 92846fc..4a9152d 100644 --- a/lib/webrat/core_extensions/hash_with_indifferent_access.rb +++ b/lib/webrat/core_extensions/hash_with_indifferent_access.rb @@ -1,7 +1,7 @@ # This class has dubious semantics and we only have it so that # people can write params[:key] instead of params['key'] # and they get the same value for both keys. -class HashWithIndifferentAccess < Hash +class HashWithIndifferentAccess < Hash #:nodoc: def initialize(constructor = {}) if constructor.is_a?(Hash) super() @@ -122,7 +122,7 @@ class HashWithIndifferentAccess < Hash end end -class Hash +class Hash #:nodoc: def with_indifferent_access hash = HashWithIndifferentAccess.new(self) hash.default = self.default diff --git a/lib/webrat/core_extensions/meta_class.rb b/lib/webrat/core_extensions/meta_class.rb index c50bbf5..d4c5011 100644 --- a/lib/webrat/core_extensions/meta_class.rb +++ b/lib/webrat/core_extensions/meta_class.rb @@ -1,4 +1,4 @@ -class ::Object +class ::Object #:nodoc: def meta_class class << self; self end end diff --git a/lib/webrat/core_extensions/nil_to_param.rb b/lib/webrat/core_extensions/nil_to_param.rb index 6386cdc..019290b 100644 --- a/lib/webrat/core_extensions/nil_to_param.rb +++ b/lib/webrat/core_extensions/nil_to_param.rb @@ -1,4 +1,4 @@ -class NilClass +class NilClass #:nodoc: def to_param nil end diff --git a/lib/webrat/mechanize.rb b/lib/webrat/mechanize.rb index ed8fe3f..5ca0da5 100644 --- a/lib/webrat/mechanize.rb +++ b/lib/webrat/mechanize.rb @@ -1,7 +1,7 @@ require "mechanize" module Webrat - class MechanizeSession < Session + class MechanizeSession < Session #:nodoc: def initialize(mechanize = WWW::Mechanize.new) super() diff --git a/lib/webrat/merb.rb b/lib/webrat/merb.rb index 3d9b3c2..6842cc5 100644 --- a/lib/webrat/merb.rb +++ b/lib/webrat/merb.rb @@ -8,7 +8,7 @@ require "merb-core" HashWithIndifferentAccess = Mash module Webrat - class MerbSession < Session + class MerbSession < Session #:nodoc: include Merb::Test::MakeRequest attr_accessor :response @@ -54,7 +54,7 @@ end module Merb module Test - module RequestHelper + module RequestHelper #:nodoc: def request(uri, env = {}) @session ||= Webrat::MerbSession.new @session.response = @session.request(uri, env) @@ -67,7 +67,7 @@ module Merb end end -class Merb::Test::RspecStory +class Merb::Test::RspecStory #:nodoc: def browser @browser ||= Webrat::MerbSession.new end diff --git a/lib/webrat/rack.rb b/lib/webrat/rack.rb index e3c2e24..931b1b9 100644 --- a/lib/webrat/rack.rb +++ b/lib/webrat/rack.rb @@ -1,6 +1,6 @@ require 'webrat' -class CGIMethods +class CGIMethods #:nodoc: def self.parse_query_parameters(params) hash = {} params.split('&').each do |p| @@ -12,7 +12,7 @@ class CGIMethods end module Webrat - class RackSession < Session + class RackSession < Session #:nodoc: def response_body @response.body end diff --git a/lib/webrat/rails.rb b/lib/webrat/rails.rb index fcf5631..89fccd3 100644 --- a/lib/webrat/rails.rb +++ b/lib/webrat/rails.rb @@ -1,7 +1,7 @@ require "webrat" module Webrat - class RailsSession < Session + class RailsSession < Session #:nodoc: def initialize(integration_session) super() @@ -42,12 +42,12 @@ module Webrat protected - def do_request(http_method, url, data, headers) + def do_request(http_method, url, data, headers) #:nodoc: update_protocol(url) @integration_session.request_via_redirect(http_method, remove_protocol(url), data, headers) end - def remove_protocol(href) + def remove_protocol(href) #:nodoc: if href =~ %r{^https?://www.example.com(/.*)} $LAST_MATCH_INFO.captures.first else @@ -55,7 +55,7 @@ module Webrat end end - def update_protocol(href) + def update_protocol(href) #:nodoc: if href =~ /^https:/ @integration_session.https!(true) elsif href =~ /^http:/ @@ -63,7 +63,7 @@ module Webrat end end - def response + def response #:nodoc: @integration_session.response end @@ -72,7 +72,7 @@ end module ActionController module Integration - class Session + class Session #:nodoc: unless instance_methods.include?("put_via_redirect") require "webrat/rails/redirect_actions" diff --git a/lib/webrat/rails/redirect_actions.rb b/lib/webrat/rails/redirect_actions.rb index fd3cce8..212e537 100644 --- a/lib/webrat/rails/redirect_actions.rb +++ b/lib/webrat/rails/redirect_actions.rb @@ -1,6 +1,6 @@ # For Rails before http://dev.rubyonrails.org/ticket/10497 was committed module Webrat - module RedirectActions + module RedirectActions #:nodoc: def put_via_redirect(path, parameters = {}, headers = {}) put path, parameters, headers diff --git a/lib/webrat/selenium/selenium_session.rb b/lib/webrat/selenium/selenium_session.rb index 5842ce4..a32787c 100644 --- a/lib/webrat/selenium/selenium_session.rb +++ b/lib/webrat/selenium/selenium_session.rb @@ -1,7 +1,7 @@ module Webrat class SeleniumSession - def initialize(selenium_driver) + def initialize(selenium_driver) #:nodoc: @selenium = selenium_driver extend_selenium define_location_strategies @@ -20,7 +20,7 @@ module Webrat alias_method :fills_in, :fill_in - def response_body + def response_body #:nodoc: @selenium.get_html_source end @@ -102,17 +102,17 @@ module Webrat alias_method :checks, :check - def is_ordered(*args) + def is_ordered(*args) #:nodoc: @selenium.is_ordered(*args) end - def dragdrop(*args) + def dragdrop(*args) #:nodoc: @selenium.dragdrop(*args) end protected - def adjust_if_regexp(text_or_regexp) + def adjust_if_regexp(text_or_regexp) #:nodoc: if text_or_regexp.is_a?(Regexp) "evalregex:#{text_or_regexp.inspect}" else @@ -120,13 +120,13 @@ module Webrat end end - def extend_selenium + def extend_selenium #:nodoc: extensions_file = File.join(File.dirname(__FILE__), "selenium_extensions.js") extenions_js = File.read(extensions_file) @selenium.get_eval(extenions_js) end - def define_location_strategies + def define_location_strategies #:nodoc: Dir[File.join(File.dirname(__FILE__), "location_strategy_javascript", "*.js")].sort.each do |file| strategy_js = File.read(file) strategy_name = File.basename(file, '.js') diff --git a/lib/webrat/sinatra.rb b/lib/webrat/sinatra.rb index 8858059..310868e 100644 --- a/lib/webrat/sinatra.rb +++ b/lib/webrat/sinatra.rb @@ -3,7 +3,7 @@ require 'sinatra' require 'sinatra/test/methods' module Webrat - class SinatraSession < RackSession + class SinatraSession < RackSession #:nodoc: include Sinatra::Test::Methods %w(get head post put delete).each do |verb| diff --git a/spec/webrat/rails/attaches_file_spec.rb b/spec/webrat/rails/attaches_file_spec.rb index 1e1a291..deb3499 100644 --- a/spec/webrat/rails/attaches_file_spec.rb +++ b/spec/webrat/rails/attaches_file_spec.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/helper') -describe "attaches_file" do +describe "attach_file" do before do @session = Webrat::TestSession.new @@ -14,7 +14,7 @@ describe "attaches_file" do
EOS - lambda { @session.attaches_file("Doc", "/some/path") }.should raise_error + lambda { @session.attach_file("Doc", "/some/path") }.should raise_error end it "should submit empty strings for blank file fields" do @@ -37,7 +37,7 @@ describe "attaches_file" do EOS @session.should_receive(:post).with("/widgets", { "widget" => { "file" => @uploaded_file } }) - @session.attaches_file "Document", @filename + @session.attach_file "Document", @filename @session.click_button end @@ -52,8 +52,8 @@ describe "attaches_file" do EOS @session.should_receive(:post).with("/widgets", { "widget" => { "files" => [@uploaded_file, @uploaded_file] } }) - @session.attaches_file "Document", @filename - @session.attaches_file "Spreadsheet", @filename + @session.attach_file "Document", @filename + @session.attach_file "Spreadsheet", @filename @session.click_button end @@ -66,7 +66,7 @@ describe "attaches_file" do EOS ActionController::TestUploadedFile.should_receive(:new).with(@filename, "image/png").any_number_of_times - @session.attaches_file "Picture", @filename, "image/png" + @session.attach_file "Picture", @filename, "image/png" @session.click_button end end \ No newline at end of file