diff options
author | Timm <kaspth@gmail.com> | 2013-07-23 20:42:08 +0200 |
---|---|---|
committer | Timm <kaspth@gmail.com> | 2014-06-15 23:41:07 +0200 |
commit | bc1363eb561f8dc739d9e9571ebf85c0ea292eee (patch) | |
tree | 836cefc45c0cddc819a5dae30e9ca38b97c63996 /actionpack/lib/action_dispatch/testing/assertions | |
parent | 0a7fac50186715341f16f76f1656f30aecddfe56 (diff) | |
download | rails-bc1363eb561f8dc739d9e9571ebf85c0ea292eee.tar.gz rails-bc1363eb561f8dc739d9e9571ebf85c0ea292eee.tar.bz2 rails-bc1363eb561f8dc739d9e9571ebf85c0ea292eee.zip |
Updated documentation to remove mention of HTML::Selector and clarify what is expected of a selector now.
Diffstat (limited to 'actionpack/lib/action_dispatch/testing/assertions')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/assertions/selector.rb | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb index 5045197415..5338278810 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb @@ -23,22 +23,19 @@ module ActionDispatch # # * +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 # Select and return all matching elements. # # If called with a single argument, uses that argument as a selector - # to match all elements of the current page. Returns an empty array - # if no match is found. + # to match all elements of the current page. Returns an empty + # Nokogiri::XML::NodeSet if no match is found. # - # If called with two arguments, uses the first argument as the base + # If called with two arguments, uses the first argument as the root # element and the second argument as the selector. Attempts to match the - # base element and any of its children. Returns an empty array if no - # match is found. + # root element and any of its children. + # Returns empty Nokogiri::XML::NodeSet if no match is found. # - # The selector may be a CSS selector expression (String), an expression - # with substitution values (Array) or an HTML::Selector object. + # The selector may be a CSS selector expression (String). # # # Selects all div tags # divs = css_select("div") @@ -76,7 +73,7 @@ module ActionDispatch # starting from (and including) that element and all its children in # depth-first order. # - # If no element if specified, calling +assert_select+ selects from the + # If no element is specified, calling +assert_select+ selects from the # response HTML unless +assert_select+ is called from within an +assert_select+ block. # # When called with a block +assert_select+ passes an array of selected elements @@ -99,8 +96,7 @@ module ActionDispatch # assert_select "li", 8 # end # - # The selector may be a CSS selector expression (String), an expression - # with substitution values, or an HTML::Selector object. + # The selector may be a CSS selector expression (String). # # === Equality Tests # @@ -149,14 +145,6 @@ module ActionDispatch # # # Test the content and style # assert_select "body div.header ul.menu" - # - # # Use substitution values - # assert_select "ol>li#?", /item-\d+/ - # - # # All input fields in the form have a name - # assert_select "form input" do - # assert_select "[name=?]", /.+/ # Not empty - # end def assert_select(*args, &block) @selected ||= nil @@ -299,7 +287,7 @@ module ActionDispatch text_matches = options.has_key?(:text) remaining = matches.reject do |match| - # Preserve html markup with to_s if not matching text elements + # Preserve markup with to_s for html elements content = text_matches ? match.text : match.to_s content.strip! unless NO_STRIP.include?(match.name) |