minitest-extra-matchers 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/minitest/extra/matchers/dom.rb +10 -2
- data/lib/minitest/extra/matchers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b04aa5f8c703756cbd48c5968cfff5276bc425a
|
4
|
+
data.tar.gz: edaff6cc21ae1f34b2413d0d51794332d5368de1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf423e441181baccef5727c1fb9fecf2330270667b86cceb268cba80d5e5deec257db0001afac0dda20252c0f417b1b1568a3c4f62f725a3c483ee8d860939dc
|
7
|
+
data.tar.gz: e370cc564b97929871608d67a82c5d97f4974d4f26dd8a8c1d72efd30dfddffa8a6e88e0b187192a782520541a7e1ee9e5448c829c0e52a45006d487280c531c
|
@@ -5,15 +5,23 @@ module Minitest
|
|
5
5
|
def self.included(base)
|
6
6
|
base.class_eval do
|
7
7
|
infect_an_assertion :assert_dom_equal, :must_equal_dom
|
8
|
+
infect_an_assertion :assert_attribute_equal, :must_have_attribute,
|
9
|
+
:dont_flip
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
11
13
|
def assert_dom_equal(expected, actual)
|
12
|
-
expected_dom = HTML
|
13
|
-
actual_dom = HTML
|
14
|
+
expected_dom = Nokogiri::HTML(expected).root
|
15
|
+
actual_dom = Nokogiri::HTML(actual).root
|
14
16
|
|
15
17
|
assert_equal expected_dom, actual_dom
|
16
18
|
end
|
19
|
+
|
20
|
+
def assert_attribute_equal(element, name, value)
|
21
|
+
actual = HTML::Document.new(element).root.attribute(name)
|
22
|
+
|
23
|
+
assert_equal value, actual
|
24
|
+
end
|
17
25
|
end
|
18
26
|
end
|
19
27
|
end
|