aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing/assertions
diff options
context:
space:
mode:
authorTimm <kaspth@gmail.com>2013-07-24 13:12:27 +0200
committerTimm <kaspth@gmail.com>2014-06-16 21:03:55 +0200
commit9eada2daf812ae95d47a22ebe4ecc058a980a38b (patch)
treef363da326ba2487fd58f3c60961a614e8fc24c4d /actionpack/lib/action_dispatch/testing/assertions
parente4772cc71edd13f0e3637c70b59fd6e8665e18ad (diff)
downloadrails-9eada2daf812ae95d47a22ebe4ecc058a980a38b.tar.gz
rails-9eada2daf812ae95d47a22ebe4ecc058a980a38b.tar.bz2
rails-9eada2daf812ae95d47a22ebe4ecc058a980a38b.zip
Readded some documentation about substitution values.
Diffstat (limited to 'actionpack/lib/action_dispatch/testing/assertions')
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/selector.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb
index 5338278810..feb98f7e2b 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb
@@ -35,7 +35,8 @@ module ActionDispatch
# 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).
+ # The selector may be a CSS selector expression (String) or an expression
+ # with substitution values (Array).
#
# # Selects all div tags
# divs = css_select("div")
@@ -96,7 +97,8 @@ module ActionDispatch
# assert_select "li", 8
# end
#
- # The selector may be a CSS selector expression (String).
+ # The selector may be a CSS selector expression (String) or an expression
+ # with substitution values (Array).
#
# === Equality Tests
#
@@ -145,6 +147,14 @@ 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