rails-dom-testing 1.0.5 → 1.0.6

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: 6a29feb41b5ab1bec20c3f358c1ff848f66db985
4
- data.tar.gz: beaf92796b4e2d31e4e4b58515f48e8ba400344a
3
+ metadata.gz: 724b5c435bae94b76380a61fac570c5092c3d81f
4
+ data.tar.gz: 540c6659e6b2589084adedba5b712c94de84ac4e
5
5
  SHA512:
6
- metadata.gz: 823c8ce6237dd7a47600be8275a615243a887aa2e5d20bcfe5d527d189467fadb274783907645f49426132cce513f6e945c0b2bd38f386ffcd570851f75d7b70
7
- data.tar.gz: ca1f844b515eb7de1d6201bf0341abe212b5a1502adf02d13c0051d44da5821302e920f8d8ce25f5c77ec047dc1c9f1b5c75bf7d6d51a370c1354ac47c0a48fd
6
+ metadata.gz: fc1af6fd6f6b348867bed35bd3f01644085880958de07eb73964db9f4ce36ec2868a6e68602724db40893fac95f516f8dda7d07b82be8f6cc02761e54e47e46a
7
+ data.tar.gz: e4d7320a4af4d767149ecb4e0f29753c913fe92fa0fd30253dfb0212b5968b5417062a2ffa682aae8da3745ab2ee37bfd89ef085747e2e3562378a6f245a0d28
data/README.md CHANGED
@@ -6,6 +6,15 @@ Doms are compared via `assert_dom_equal` and `assert_dom_not_equal`.
6
6
  Elements are asserted via `assert_select`, `assert_select_encoded`, `assert_select_email` and a subset of the dom can be selected with `css_select`.
7
7
  The gem is developed for Rails 4.2 and above, and will not work on previous versions.
8
8
 
9
+ ## Deprecation warnings when upgrading to Rails 4.2:
10
+
11
+ Nokogiri is slightly more strict about the format of css selectors than the previous implementation. That's why you have warnings like:
12
+
13
+ ```
14
+ DEPRECATION WARNING: The assertion was not run because of an invalid css selector.
15
+ ```
16
+
17
+ Check the 4.2 release notes [section on `assert_select`](http://edgeguides.rubyonrails.org/4_2_release_notes.html#assert-select) for help.
9
18
 
10
19
  ## Installation
11
20
 
@@ -1,27 +1,21 @@
1
1
  class SubstitutionContext
2
2
  def initialize
3
3
  @substitute = '?'
4
- @regexes = []
5
4
  end
6
5
 
7
6
  def substitute!(selector, values)
8
7
  while !values.empty? && substitutable?(values.first) && selector.index(@substitute)
9
- selector.sub! @substitute, substitution_id_for(values.shift)
8
+ selector.sub! @substitute, matcher_for(values.shift)
10
9
  end
11
10
  end
12
11
 
13
- def match(matches, attribute, substitution_id)
14
- matches.find_all { |node| node[attribute] =~ @regexes[substitution_id] }
12
+ def match(matches, attribute, matcher)
13
+ matches.find_all { |node| node[attribute] =~ Regexp.new(matcher) }
15
14
  end
16
15
 
17
16
  private
18
- def substitution_id_for(value)
19
- if value.is_a?(Regexp)
20
- @regexes << value
21
- @regexes.size - 1
22
- else
23
- value
24
- end.inspect # Nokogiri doesn't like arbitrary values without quotes, hence inspect.
17
+ def matcher_for(value)
18
+ value.to_s.inspect # Nokogiri doesn't like arbitrary values without quotes, hence inspect.
25
19
  end
26
20
 
27
21
  def substitutable?(value)
@@ -1,7 +1,7 @@
1
1
  module Rails
2
2
  module Dom
3
3
  module Testing
4
- VERSION = "1.0.5"
4
+ VERSION = "1.0.6"
5
5
  end
6
6
  end
7
7
  end
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.5
4
+ version: 1.0.6
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-11-25 00:00:00.000000000 Z
12
+ date: 2015-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -101,7 +101,8 @@ dependencies:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
- description: " Dom and Selector assertions for Rails applications "
104
+ description: " This gem can compare doms and assert certain elements exists in doms
105
+ using Nokogiri. "
105
106
  email:
106
107
  - rafaelmfranca@gmail.com
107
108
  - kaspth@gmail.com
@@ -124,7 +125,7 @@ files:
124
125
  - test/selector_assertions_test.rb
125
126
  - test/tag_assertions_test.rb
126
127
  - test/test_helper.rb
127
- homepage: https://github.com/kaspth/rails-dom-testing
128
+ homepage: https://github.com/rails/rails-dom-testing
128
129
  licenses:
129
130
  - MIT
130
131
  metadata: {}
@@ -144,11 +145,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
145
  version: '0'
145
146
  requirements: []
146
147
  rubyforge_project:
147
- rubygems_version: 2.2.2
148
+ rubygems_version: 2.4.5
148
149
  signing_key:
149
150
  specification_version: 4
150
- summary: This gem can compare doms and assert certain elements exists in doms using
151
- Nokogiri.
151
+ summary: Dom and Selector assertions for Rails applications
152
152
  test_files:
153
153
  - test/dom_assertions_test.rb
154
154
  - test/selector_assertions_test.rb