aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan McGeary <ryan@mcgeary.org>2013-08-04 08:53:22 -0400
committerRyan McGeary <ryan@mcgeary.org>2013-08-04 11:18:46 -0400
commit51520a75d5df51e865f00c9d6061d7b16a3cda4b (patch)
tree215db4e6a1f6eabfa8bfa60e5213325d3205fe68
parent72293857c7e757efe1d79b1b51b9d15a4ac99fb6 (diff)
downloadrails-51520a75d5df51e865f00c9d6061d7b16a3cda4b.tar.gz
rails-51520a75d5df51e865f00c9d6061d7b16a3cda4b.tar.bz2
rails-51520a75d5df51e865f00c9d6061d7b16a3cda4b.zip
Pass assert_dom_equal message arg to underlying assertion
#assert_dom_equal and #assert_dom_not_equal both take a "failure" message argument, but this argument was not utilized.
-rw-r--r--actionpack/CHANGELOG.md7
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/dom.rb8
2 files changed, 11 insertions, 4 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index f8308299fa..d848095e01 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,3 +1,10 @@
+* Fix an issue where `assert_dom_equal` and `assert_dom_not_equal` were
+ ignoring the passed failure message argument.
+
+ Fixes #11751
+
+ *Ryan McGeary*
+
* Allow REMOTE_ADDR, HTTP_HOST and HTTP_USER_AGENT to be overridden from
the environment passed into `ActionDispatch::TestRequest.new`.
diff --git a/actionpack/lib/action_dispatch/testing/assertions/dom.rb b/actionpack/lib/action_dispatch/testing/assertions/dom.rb
index 8f90a1223e..241a39393a 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/dom.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/dom.rb
@@ -7,20 +7,20 @@ module ActionDispatch
#
# # assert that the referenced method generates the appropriate HTML string
# assert_dom_equal '<a href="http://www.example.com">Apples</a>', link_to("Apples", "http://www.example.com")
- def assert_dom_equal(expected, actual, message = "")
+ def assert_dom_equal(expected, actual, message = nil)
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
- assert_equal expected_dom, actual_dom
+ assert_equal expected_dom, actual_dom, message
end
# The negated form of +assert_dom_equivalent+.
#
# # assert that the referenced method does not generate the specified HTML string
# assert_dom_not_equal '<a href="http://www.example.com">Apples</a>', link_to("Oranges", "http://www.example.com")
- def assert_dom_not_equal(expected, actual, message = "")
+ def assert_dom_not_equal(expected, actual, message = nil)
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
- assert_not_equal expected_dom, actual_dom
+ assert_not_equal expected_dom, actual_dom, message
end
end
end