Skip to content

Commit

Permalink
Remove assert_tag and assert_no_tag
Browse files Browse the repository at this point in the history
These assertions were removed from rails 5.
  • Loading branch information
blowmage committed Jul 1, 2016
1 parent 0f568fa commit bbb0a70
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 400 deletions.
274 changes: 0 additions & 274 deletions lib/minitest/rails/assertions.rb
Expand Up @@ -392,143 +392,6 @@ class ActionView::TestCase
# :method: assert_dom_equal
# :call-seq: assert_dom_equal(expected, actual, message = nil)
alias :refute_dom_equal :assert_dom_not_equal

##
# Asserts that there is a tag/node/element in the body of the response
# that meets all of the given conditions. The +conditions+ parameter must
# be a hash of any of the following keys (all are optional):
#
# * <tt>:tag</tt>: the node type must match the corresponding value
# * <tt>:attributes</tt>: a hash. The node's attributes must match the
# corresponding values in the hash.
# * <tt>:parent</tt>: a hash. The node's parent must match the
# corresponding hash.
# * <tt>:child</tt>: a hash. At least one of the node's immediate children
# must meet the criteria described by the hash.
# * <tt>:ancestor</tt>: a hash. At least one of the node's ancestors must
# meet the criteria described by the hash.
# * <tt>:descendant</tt>: a hash. At least one of the node's descendants
# must meet the criteria described by the hash.
# * <tt>:sibling</tt>: a hash. At least one of the node's siblings must
# meet the criteria described by the hash.
# * <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.
# * <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.
# * <tt>:children</tt>: a hash, for counting children of a node. Accepts
# the keys:
# * <tt>:count</tt>: either a number or a range which must equal (or
# include) the number of children that match.
# * <tt>:less_than</tt>: the number of matching children must be less
# than this number.
# * <tt>:greater_than</tt>: the number of matching children must be
# greater than this number.
# * <tt>:only</tt>: another hash consisting of the keys to use
# to match on the children, and only matching children will be
# counted.
# * <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.
#
# Conditions are matched using the following algorithm:
#
# * if the condition is a string, it must be a substring of the value.
# * if the condition is a regexp, it must match the value.
# * if the condition is a number, the value must match number.to_s.
# * if the condition is +true+, the value must not be +nil+.
# * if the condition is +false+ or +nil+, the value must be +nil+.
#
# # Assert that there is a "span" tag
# assert_tag tag: "span"
#
# # Assert that there is a "span" tag with id="x"
# assert_tag tag: "span", attributes: { id: "x" }
#
# # Assert that there is a "span" tag using the short-hand
# assert_tag :span
#
# # Assert that there is a "span" tag with id="x" using the short-hand
# assert_tag :span, attributes: { id: "x" }
#
# # Assert that there is a "span" inside of a "div"
# assert_tag tag: "span", parent: { tag: "div" }
#
# # Assert that there is a "span" somewhere inside a table
# assert_tag tag: "span", ancestor: { tag: "table" }
#
# # Assert that there is a "span" with at least one "em" child
# assert_tag tag: "span", child: { tag: "em" }
#
# # Assert that there is a "span" containing a (possibly nested)
# # "strong" tag.
# assert_tag tag: "span", descendant: { tag: "strong" }
#
# # Assert that there is a "span" containing between 2 and 4 "em" tags
# # as immediate children
# assert_tag tag: "span",
# children: { count: 2..4, only: { tag: "em" } }
#
# # Get funky: assert that there is a "div", with an "ul" ancestor
# # and an "li" parent (with "class" = "enum"), and containing a
# # "span" descendant that contains text matching /hello world/
# assert_tag tag: "div",
# ancestor: { tag: "ul" },
# parent: { tag: "li",
# attributes: { class: "enum" } },
# descendant: { tag: "span",
# child: /hello world/ }
#
# <b>Please note</b>: +assert_tag+ and +assert_no_tag+ 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>
#
# See also Minitest::Rails::Expectations#must_have_tag
#
# :method: assert_tag
# :call-seq: assert_tag(*opts)

##
# Identical to +assert_tag+, but asserts that a matching tag does _not_
# exist. (See +assert_tag+ for a full discussion of the syntax.)
#
# # Assert that there is not a "div" containing a "p"
# assert_no_tag tag: "div", descendant: { tag: "p" }
#
# # Assert that an unordered list is empty
# assert_no_tag tag: "ul", descendant: { tag: "li" }
#
# # Assert that there is not a "p" tag with between 1 to 3 "img" tags
# # as immediate children
# assert_no_tag tag: "p",
# children: { count: 1..3, only: { tag: "img" } }
#
# See also Minitest::Rails::Expectations#wont_have_tag
#
# :method: assert_no_tag
# :call-seq: assert_no_tag(*opts)

##
# Identical to +assert_tag+, but asserts that a matching tag does _not_
# exist. (See +assert_tag+ for a full discussion of the syntax.)
#
# # Assert that there is not a "div" containing a "p"
# assert_no_tag tag: "div", descendant: { tag: "p" }
#
# # Assert that an unordered list is empty
# assert_no_tag tag: "ul", descendant: { tag: "li" }
#
# # Assert that there is not a "p" tag with between 1 to 3 "img" tags
# # as immediate children
# assert_no_tag tag: "p",
# children: { count: 1..3, only: { tag: "img" } }
#
# See also Minitest::Rails::Expectations#wont_have_tag
#
# :method: refute_tag
# :call-seq: refute_tag(*opts)
alias :refute_tag :assert_no_tag
end

class ActionDispatch::IntegrationTest
Expand Down Expand Up @@ -886,143 +749,6 @@ class ActionDispatch::IntegrationTest
# :method: assert_dom_equal
# :call-seq: assert_dom_equal(expected, actual, message = nil)
alias :refute_dom_equal :assert_dom_not_equal

##
# Asserts that there is a tag/node/element in the body of the response
# that meets all of the given conditions. The +conditions+ parameter must
# be a hash of any of the following keys (all are optional):
#
# * <tt>:tag</tt>: the node type must match the corresponding value
# * <tt>:attributes</tt>: a hash. The node's attributes must match the
# corresponding values in the hash.
# * <tt>:parent</tt>: a hash. The node's parent must match the
# corresponding hash.
# * <tt>:child</tt>: a hash. At least one of the node's immediate children
# must meet the criteria described by the hash.
# * <tt>:ancestor</tt>: a hash. At least one of the node's ancestors must
# meet the criteria described by the hash.
# * <tt>:descendant</tt>: a hash. At least one of the node's descendants
# must meet the criteria described by the hash.
# * <tt>:sibling</tt>: a hash. At least one of the node's siblings must
# meet the criteria described by the hash.
# * <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.
# * <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.
# * <tt>:children</tt>: a hash, for counting children of a node. Accepts
# the keys:
# * <tt>:count</tt>: either a number or a range which must equal (or
# include) the number of children that match.
# * <tt>:less_than</tt>: the number of matching children must be less
# than this number.
# * <tt>:greater_than</tt>: the number of matching children must be
# greater than this number.
# * <tt>:only</tt>: another hash consisting of the keys to use
# to match on the children, and only matching children will be
# counted.
# * <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.
#
# Conditions are matched using the following algorithm:
#
# * if the condition is a string, it must be a substring of the value.
# * if the condition is a regexp, it must match the value.
# * if the condition is a number, the value must match number.to_s.
# * if the condition is +true+, the value must not be +nil+.
# * if the condition is +false+ or +nil+, the value must be +nil+.
#
# # Assert that there is a "span" tag
# assert_tag tag: "span"
#
# # Assert that there is a "span" tag with id="x"
# assert_tag tag: "span", attributes: { id: "x" }
#
# # Assert that there is a "span" tag using the short-hand
# assert_tag :span
#
# # Assert that there is a "span" tag with id="x" using the short-hand
# assert_tag :span, attributes: { id: "x" }
#
# # Assert that there is a "span" inside of a "div"
# assert_tag tag: "span", parent: { tag: "div" }
#
# # Assert that there is a "span" somewhere inside a table
# assert_tag tag: "span", ancestor: { tag: "table" }
#
# # Assert that there is a "span" with at least one "em" child
# assert_tag tag: "span", child: { tag: "em" }
#
# # Assert that there is a "span" containing a (possibly nested)
# # "strong" tag.
# assert_tag tag: "span", descendant: { tag: "strong" }
#
# # Assert that there is a "span" containing between 2 and 4 "em" tags
# # as immediate children
# assert_tag tag: "span",
# children: { count: 2..4, only: { tag: "em" } }
#
# # Get funky: assert that there is a "div", with an "ul" ancestor
# # and an "li" parent (with "class" = "enum"), and containing a
# # "span" descendant that contains text matching /hello world/
# assert_tag tag: "div",
# ancestor: { tag: "ul" },
# parent: { tag: "li",
# attributes: { class: "enum" } },
# descendant: { tag: "span",
# child: /hello world/ }
#
# <b>Please note</b>: +assert_tag+ and +assert_no_tag+ 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>
#
# See also Minitest::Rails::Expectations#must_have_tag
#
# :method: assert_tag
# :call-seq: assert_tag(*opts)

##
# Identical to +assert_tag+, but asserts that a matching tag does _not_
# exist. (See +assert_tag+ for a full discussion of the syntax.)
#
# # Assert that there is not a "div" containing a "p"
# assert_no_tag tag: "div", descendant: { tag: "p" }
#
# # Assert that an unordered list is empty
# assert_no_tag tag: "ul", descendant: { tag: "li" }
#
# # Assert that there is not a "p" tag with between 1 to 3 "img" tags
# # as immediate children
# assert_no_tag tag: "p",
# children: { count: 1..3, only: { tag: "img" } }
#
# See also Minitest::Rails::Expectations#wont_have_tag
#
# :method: assert_no_tag
# :call-seq: assert_no_tag(*opts)

##
# Identical to +assert_tag+, but asserts that a matching tag does _not_
# exist. (See +assert_tag+ for a full discussion of the syntax.)
#
# # Assert that there is not a "div" containing a "p"
# assert_no_tag tag: "div", descendant: { tag: "p" }
#
# # Assert that an unordered list is empty
# assert_no_tag tag: "ul", descendant: { tag: "li" }
#
# # Assert that there is not a "p" tag with between 1 to 3 "img" tags
# # as immediate children
# assert_no_tag tag: "p",
# children: { count: 1..3, only: { tag: "img" } }
#
# See also Minitest::Rails::Expectations#wont_have_tag
#
# :method: refute_tag
# :call-seq: refute_tag(*opts)
alias :refute_tag :assert_no_tag
end

if defined? ActiveJob
Expand Down
2 changes: 0 additions & 2 deletions lib/minitest/rails/controller.rb
Expand Up @@ -8,8 +8,6 @@ class ActionController::TestCase # :nodoc:
alias :must_respond_with :assert_response
alias :must_redirect_to :assert_redirected_to
alias :must_render_template :assert_template
alias :must_have_tag :assert_tag
alias :wont_have_tag :assert_no_tag
alias :must_select :assert_select
alias :must_select_email :assert_select_email
alias :must_select_encoded :assert_select_encoded
Expand Down

0 comments on commit bbb0a70

Please sign in to comment.