Skip to content

Commit

Permalink
Revert "call-seq directive makes rdoc cry and replaces method names w…
Browse files Browse the repository at this point in the history
…ith a curly brace; besides it doesn't add anything when you only list one call example since this is obviously documented already"

Reason: Part of this commit touches vendorized stuff, the rest is fine, could you please repatch?

This reverts commit 60de0e5.
  • Loading branch information
fxn committed Aug 27, 2010
1 parent 4a56f8f commit 27d42a5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,18 @@ class InvalidSelectorError < StandardError #:nodoc:

class << self

# :call-seq:
# Selector.for_class(cls) => selector
#
# Creates a new selector for the given class name.
def for_class(cls)
self.new([".?", cls])
end


# :call-seq:
# Selector.for_id(id) => selector
#
# Creates a new selector for the given id.
def for_id(id)
self.new(["#?", id])
Expand All @@ -221,6 +227,9 @@ def for_id(id)
end


# :call-seq:
# Selector.new(string, [values ...]) => selector
#
# Creates a new selector from a CSS 2 selector expression.
#
# The first argument is the selector expression. All other arguments
Expand Down Expand Up @@ -333,6 +342,9 @@ def initialize(selector, *values)
end


# :call-seq:
# match(element, first?) => array or nil
#
# Matches an element against the selector.
#
# For a simple selector this method returns an array with the
Expand Down Expand Up @@ -422,6 +434,9 @@ def match(element, first_only = false)
end


# :call-seq:
# select(root) => array
#
# Selects and returns an array with all matching elements, beginning
# with one node and traversing through all children depth-first.
# Returns an empty array if no match is found.
Expand Down
37 changes: 28 additions & 9 deletions actionpack/lib/action_dispatch/testing/assertions/selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module ActionDispatch
module Assertions
NO_STRIP = %w{pre script style textarea}

# Adds the +assert_select+ method for use in \Rails functional
# Adds the +assert_select+ method for use in Rails functional
# test cases, which can be used to make assertions on the response HTML of a controller
# action. You can also call +assert_select+ within another +assert_select+ to
# make assertions on elements selected by the enclosing assertion.
Expand All @@ -18,12 +18,16 @@ module Assertions
# from the response HTML or elements selected by the enclosing assertion.
#
# In addition to HTML responses, you can make the following assertions:
# * +assert_select_rjs+ - \Assertions on HTML content of RJS update and insertion operations.
# * +assert_select_encoded+ - \Assertions on HTML encoded inside XML, for example for dealing with feed item descriptions.
# * +assert_select_email+ - \Assertions on the HTML body of an e-mail.
# * +assert_select_rjs+ - Assertions on HTML content of RJS update and insertion operations.
# * +assert_select_encoded+ - Assertions on HTML encoded inside XML, for example for dealing with feed item descriptions.
# * +assert_select_email+ - Assertions on the HTML body of an e-mail.
#
# Also see HTML::Selector to learn how to use selectors.
module SelectorAssertions
# :call-seq:
# css_select(selector) => array
# css_select(element, selector) => array
#
# Select and return all matching elements.
#
# If called with a single argument, uses that argument as a selector
Expand All @@ -35,7 +39,7 @@ module SelectorAssertions
# base element and any of its children. Returns an empty array if no
# match is found.
#
# The selector may be a CSS selector expression (string), an expression
# The selector may be a CSS selector expression (String), an expression
# with substitution values (Array) or an HTML::Selector object.
#
# ==== Examples
Expand Down Expand Up @@ -95,6 +99,10 @@ def css_select(*args)
selector.select(root)
end

# :call-seq:
# assert_select(selector, equality?, message?)
# assert_select(element, selector, equality?, message?)
#
# An assertion that selects elements and makes one or more equality tests.
#
# If the first argument is an element, selects all matching elements
Expand Down Expand Up @@ -124,19 +132,19 @@ def css_select(*args)
# assert_select "li", 8
# end
#
# The selector may be a CSS selector expression (string), an expression
# The selector may be a CSS selector expression (String), an expression
# with substitution values, or an HTML::Selector object.
#
# === Equality Tests
#
# The equality test may be one of the following:
# * <tt>true</tt> - Assertion is true if at least one element selected.
# * <tt>false</tt> - Assertion is true if no element selected.
# * <tt>string/Regexp</tt> - Assertion is true if the text value of at least
# * <tt>String/Regexp</tt> - Assertion is true if the text value of at least
# one element matches the string or regular expression.
# * <tt>integer</tt> - Assertion is true if exactly that number of
# * <tt>Integer</tt> - Assertion is true if exactly that number of
# elements are selected.
# * <tt>range</tt> - Assertion is true if the number of selected
# * <tt>Range</tt> - Assertion is true if the number of selected
# elements fit the range.
# If no equality test specified, the assertion is true if at least one
# element selected.
Expand Down Expand Up @@ -324,6 +332,11 @@ def count_description(min, max, count) #:nodoc:
end
end

# :call-seq:
# assert_select_rjs(id?) { |elements| ... }
# assert_select_rjs(statement, id?) { |elements| ... }
# assert_select_rjs(:insert, position, id?) { |elements| ... }
#
# Selects content from the RJS response.
#
# === Narrowing down
Expand Down Expand Up @@ -461,6 +474,9 @@ def assert_select_rjs(*args, &block)
end
end

# :call-seq:
# assert_select_encoded(element?) { |elements| ... }
#
# Extracts the content of an element, treats it as encoded HTML and runs
# nested assertion on it.
#
Expand Down Expand Up @@ -527,6 +543,9 @@ def assert_select_encoded(element = nil, &block)
end
end

# :call-seq:
# assert_select_email { }
#
# Extracts the body of an email and runs nested assertions on it.
#
# You must enable deliveries for this assertion to work, use:
Expand Down
3 changes: 3 additions & 0 deletions activerecord/lib/active_record/persistence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def persisted?
!(new_record? || destroyed?)
end

# :call-seq:
# save(options)
#
# Saves the model.
#
# If the model is new a record gets created in the database, otherwise
Expand Down

0 comments on commit 27d42a5

Please sign in to comment.