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: 44d4f14bd073cd6863e98c91e68cdd0841b79f03
4
- data.tar.gz: 52bfa7441b482a26893322386ec0774542153804
3
+ metadata.gz: 65398ee552b3e2bb13fc42eccfff4620cac17bed
4
+ data.tar.gz: 2765f5b8e4262a28e4c9e04f7892f75e8dd7b6ee
5
5
  SHA512:
6
- metadata.gz: 75a264e23323a077ae8a5d73e3f356689b7eb48d7a35e75cecce81c74423ba8b638d75dca49c593252acd18de4de6e3f1b6cd0b3e8db9e669a421b0e76339a1c
7
- data.tar.gz: 36b2b12547bca87796e856f01684af0895a97239f649fa7e40cf66c4f49732b23965d425ce38b87f3acd8ff7703a94c528488e888342b856063141bd5d5a3df6
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
- nodeset(root).css(selector)
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
- nodeset document_root_element
313
+ document_root_element
312
314
  end
313
315
  end
314
316
 
@@ -1,7 +1,7 @@
1
1
  module Rails
2
2
  module Dom
3
3
  module Testing
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
6
6
  end
7
7
  end
@@ -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::Document.parse(content)
298
+ Nokogiri::XML::DocumentFragment.parse(content)
294
299
  else
295
- Nokogiri::HTML::Document.parse(content)
300
+ Nokogiri::HTML::DocumentFragment.parse(content)
296
301
  end
297
302
  end
298
303
 
299
304
  def document_root_element
300
- @html_document.root
305
+ @html_document
301
306
  end
302
307
  end
@@ -1,4 +1,6 @@
1
1
  require 'nokogiri'
2
2
  require 'active_support'
3
3
  require 'active_support/test_case'
4
- require 'minitest/autorun'
4
+ require 'minitest/autorun'
5
+
6
+ ActiveSupport::TestCase.test_order = :random
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.3
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-09-25 00:00:00.000000000 Z
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: '0'
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: '0'
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.2.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: