rails-dom-testing 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65398ee552b3e2bb13fc42eccfff4620cac17bed
|
4
|
+
data.tar.gz: 2765f5b8e4262a28e4c9e04f7892f75e8dd7b6ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9295246ea1524127de19fe80e3428d3828606fbadcd092b5e65270bbe803d804cb9757a41438e71c568251fb9a1535b6d811951e77f13f3e6a473af614ed9d4a
|
7
|
+
data.tar.gz: 41e731b6ab7cf71ca3f0e3645660354d426bdc45edc3da0d69cbaad6d93f6cf8a4e16a4f697061274d83b8fcfd89b4d88ef8fa3e5cf92ffee15f32d77f42f97e
|
@@ -62,7 +62,9 @@ module Rails
|
|
62
62
|
selector = args.first
|
63
63
|
|
64
64
|
begin
|
65
|
-
|
65
|
+
root.css(selector).tap do |matches|
|
66
|
+
return nodeset(root).css(selector) if matches.empty?
|
67
|
+
end
|
66
68
|
rescue Nokogiri::CSS::SyntaxError => e
|
67
69
|
ActiveSupport::Deprecation.warn("The assertion was not run because of an invalid css selector.\n#{e}", caller(2))
|
68
70
|
return
|
@@ -308,7 +310,7 @@ module Rails
|
|
308
310
|
elsif previous_selection
|
309
311
|
previous_selection
|
310
312
|
else
|
311
|
-
|
313
|
+
document_root_element
|
312
314
|
end
|
313
315
|
end
|
314
316
|
|
@@ -279,6 +279,11 @@ EOF
|
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
|
+
def test_body_not_present_in_empty_document
|
283
|
+
render_html ''
|
284
|
+
assert_select 'body', 0
|
285
|
+
end
|
286
|
+
|
282
287
|
protected
|
283
288
|
def render_html(html)
|
284
289
|
fake_render(:html, html)
|
@@ -290,13 +295,13 @@ EOF
|
|
290
295
|
|
291
296
|
def fake_render(content_type, content)
|
292
297
|
@html_document = if content_type == :xml
|
293
|
-
Nokogiri::XML::
|
298
|
+
Nokogiri::XML::DocumentFragment.parse(content)
|
294
299
|
else
|
295
|
-
Nokogiri::HTML::
|
300
|
+
Nokogiri::HTML::DocumentFragment.parse(content)
|
296
301
|
end
|
297
302
|
end
|
298
303
|
|
299
304
|
def document_root_element
|
300
|
-
@html_document
|
305
|
+
@html_document
|
301
306
|
end
|
302
307
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-dom-testing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Mendonça França
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -31,14 +31,20 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 4.2.0.beta
|
35
|
+
- - "<"
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '5.0'
|
35
38
|
type: :runtime
|
36
39
|
prerelease: false
|
37
40
|
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
requirements:
|
39
42
|
- - ">="
|
40
43
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
44
|
+
version: 4.2.0.beta
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
49
|
name: rails-deprecated_sanitizer
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
143
|
version: '0'
|
138
144
|
requirements: []
|
139
145
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.4.2
|
141
147
|
signing_key:
|
142
148
|
specification_version: 4
|
143
149
|
summary: This gem can compare doms and assert certain elements exists in doms using
|
@@ -147,3 +153,4 @@ test_files:
|
|
147
153
|
- test/selector_assertions_test.rb
|
148
154
|
- test/tag_assertions_test.rb
|
149
155
|
- test/test_helper.rb
|
156
|
+
has_rdoc:
|