--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: "Asserts that there is a tag/node/element in the body of the response that meets all of the given conditions. The <tt>conditions</tt> parameter must be a hash of any of the following keys (all are optional):"
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:tag</tt>: the node type must match the corresponding value"
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:attributes</tt>: a hash. The node's attributes must match the corresponding values in the hash."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:parent</tt>: a hash. The node's parent must match the corresponding hash."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:child</tt>: a hash. At least one of the node's immediate children must meet the criteria described by the hash."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:ancestor</tt>: a hash. At least one of the node's ancestors must meet the criteria described by the hash."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:descendant</tt>: a hash. At least one of the node's descendants must meet the criteria described by the hash."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:sibling</tt>: a hash. At least one of the node's siblings must meet the criteria described by the hash."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:after</tt>: a hash. The node must be after any sibling meeting the criteria described by the hash, and at least one sibling must match."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:before</tt>: a hash. The node must be before any sibling meeting the criteria described by the hash, and at least one sibling must match."
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:children</tt>: a hash, for counting children of a node. Accepts the keys:"
  - !ruby/object:SM::Flow::LIST 
    contents: 
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: "<tt>:count</tt>: either a number or a range which must equal (or include) the number of children that match."
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: "<tt>:less_than</tt>: the number of matching children must be less than this number."
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: "<tt>:greater_than</tt>: the number of matching children must be greater than this number."
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: "<tt>:only</tt>: another hash consisting of the keys to use to match on the children, and only matching children will be counted."
    type: :BULLET
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>:content</tt>: the textual content of the node must match the given value. This will not match HTML tags in the body of a tag--only text."
  type: :BULLET
- !ruby/struct:SM::Flow::P 
  body: "Conditions are matched using the following algorithm:"
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: if the condition is a string, it must be a substring of the value.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: if the condition is a regexp, it must match the value.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: if the condition is a number, the value must match number.to_s.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: if the condition is <tt>true</tt>, the value must not be <tt>nil</tt>.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: if the condition is <tt>false</tt> or <tt>nil</tt>, the value must be <tt>nil</tt>.
  type: :BULLET
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Examples
- !ruby/struct:SM::Flow::VERB 
  body: "  # Assert that there is a &quot;span&quot; tag\n  assert_tag :tag =&gt; &quot;span&quot;\n\n  # Assert that there is a &quot;span&quot; tag with id=&quot;x&quot;\n  assert_tag :tag =&gt; &quot;span&quot;, :attributes =&gt; { :id =&gt; &quot;x&quot; }\n\n  # Assert that there is a &quot;span&quot; tag using the short-hand\n  assert_tag :span\n\n  # Assert that there is a &quot;span&quot; tag with id=&quot;x&quot; using the short-hand\n  assert_tag :span, :attributes =&gt; { :id =&gt; &quot;x&quot; }\n\n  # Assert that there is a &quot;span&quot; inside of a &quot;div&quot;\n  assert_tag :tag =&gt; &quot;span&quot;, :parent =&gt; { :tag =&gt; &quot;div&quot; }\n\n  # Assert that there is a &quot;span&quot; somewhere inside a table\n  assert_tag :tag =&gt; &quot;span&quot;, :ancestor =&gt; { :tag =&gt; &quot;table&quot; }\n\n  # Assert that there is a &quot;span&quot; with at least one &quot;em&quot; child\n  assert_tag :tag =&gt; &quot;span&quot;, :child =&gt; { :tag =&gt; &quot;em&quot; }\n\n  # Assert that there is a &quot;span&quot; containing a (possibly nested)\n  # &quot;strong&quot; tag.\n  assert_tag :tag =&gt; &quot;span&quot;, :descendant =&gt; { :tag =&gt; &quot;strong&quot; }\n\n  # Assert that there is a &quot;span&quot; containing between 2 and 4 &quot;em&quot; tags\n  # as immediate children\n  assert_tag :tag =&gt; &quot;span&quot;,\n             :children =&gt; { :count =&gt; 2..4, :only =&gt; { :tag =&gt; &quot;em&quot; } }\n\n  # Get funky: assert that there is a &quot;div&quot;, with an &quot;ul&quot; ancestor\n  # and an &quot;li&quot; parent (with &quot;class&quot; = &quot;enum&quot;), and containing a\n  # &quot;span&quot; descendant that contains text matching /hello world/\n  assert_tag :tag =&gt; &quot;div&quot;,\n             :ancestor =&gt; { :tag =&gt; &quot;ul&quot; },\n             :parent =&gt; { :tag =&gt; &quot;li&quot;,\n                          :attributes =&gt; { :class =&gt; &quot;enum&quot; } },\n             :descendant =&gt; { :tag =&gt; &quot;span&quot;,\n                              :child =&gt; /hello world/ }\n"
- !ruby/struct:SM::Flow::P 
  body: "<b>Please note</b>: <tt>assert_tag</tt> and <tt>assert_no_tag</tt> only work with well-formed XHTML. They recognize a few tags as implicitly self-closing (like br and hr and such) but will not work correctly with tags that allow optional closing tags (p, li, td). <em>You must explicitly close all of your tags to use these assertions.</em>"
full_name: ActionController::Assertions::TagAssertions#assert_tag
is_singleton: false
name: assert_tag
params: (*opts)
visibility: public
