diff options
author | Timm <kaspth@gmail.com> | 2013-08-28 20:07:47 +0200 |
---|---|---|
committer | Timm <kaspth@gmail.com> | 2014-06-16 21:04:12 +0200 |
commit | cb865e1a7be5240a528aa30cad9c977c387fd40c (patch) | |
tree | d26d4703454f1a367f0f41d38e9fc05d8dd74114 /actionview/lib/action_view | |
parent | 01e6e1d491d2d1bbb7dd6092730afbbf4c2217e5 (diff) | |
download | rails-cb865e1a7be5240a528aa30cad9c977c387fd40c.tar.gz rails-cb865e1a7be5240a528aa30cad9c977c387fd40c.tar.bz2 rails-cb865e1a7be5240a528aa30cad9c977c387fd40c.zip |
Removed dom_assertion method since it created bugs.
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/testing/assertions/dom.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/actionview/lib/action_view/testing/assertions/dom.rb b/actionview/lib/action_view/testing/assertions/dom.rb index 825720a56f..3357b14421 100644 --- a/actionview/lib/action_view/testing/assertions/dom.rb +++ b/actionview/lib/action_view/testing/assertions/dom.rb @@ -6,7 +6,9 @@ module ActionView # # 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 = nil) - assert dom_assertion(expected, actual, message) + expected_dom, actual_dom = Loofah.fragment(expected), Loofah.fragment(actual) + message ||= "Expected: #{expected}\nActual: #{actual}" + assert compare_doms(expected_dom, actual_dom), message end # The negated form of +assert_dom_equal+. @@ -14,16 +16,12 @@ module ActionView # # 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 = nil) - assert_not dom_assertion(expected, actual, message) + expected_dom, actual_dom = Loofah.fragment(expected), Loofah.fragment(actual) + message ||= "Expected: #{expected}\nActual: #{actual}" + assert_not compare_doms(expected_dom, actual_dom), message end protected - def dom_assertion(expected_string, actual_string, message = nil) - expected, actual = Loofah.fragment(expected_string), Loofah.fragment(actual_string) - message ||= "Expected: #{expected}\nActual: #{actual}" - return compare_doms(expected, actual), message - end - def compare_doms(expected, actual) return false unless expected.children.size == actual.children.size |