rspec-html-matchers 0.8.1 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +45 -12
- data/README.md +13 -18
- data/features/step_definitions/steps.rb +3 -1
- data/features/support/env.rb +22 -3
- data/lib/rspec-html-matchers.rb +160 -356
- data/lib/rspec-html-matchers/have_tag.rb +290 -0
- data/lib/rspec-html-matchers/nokogiri_regexp_helper.rb +17 -0
- data/lib/rspec-html-matchers/nokogiri_text_helper.rb +24 -0
- data/lib/rspec-html-matchers/version.rb +5 -0
- data/spec/form_matchers_spec.rb +132 -130
- data/spec/have_empty_tag_spec.rb +9 -7
- data/spec/have_tag_spec.rb +270 -166
- data/spec/issues_spec.rb +17 -0
- data/spec/spec_helper.rb +3 -1
- data/spec/support/asset_helpers.rb +5 -5
- data/spec/support/raise_spec_error_helper.rb +9 -7
- metadata +58 -25
data/spec/issues_spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'spec_helper'
|
5
|
+
|
6
|
+
describe 'working on github issues' do
|
7
|
+
it '[seen Option Not Matching Seen Text (https://github.com/kucaahbe/rspec-html-matchers/issues/73)]' do
|
8
|
+
rendered = <<HTML
|
9
|
+
<p>
|
10
|
+
content with ignored
|
11
|
+
spaces
|
12
|
+
around
|
13
|
+
</p>
|
14
|
+
HTML
|
15
|
+
expect(rendered).to have_tag('p', :seen => 'content with ignored spaces around')
|
16
|
+
end
|
17
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
if defined?(SimpleCov)
|
2
4
|
SimpleCov.start do
|
3
5
|
add_group 'Main', '/lib/'
|
@@ -16,7 +18,7 @@ RSpec.configure do |config|
|
|
16
18
|
c.syntax = :expect
|
17
19
|
end
|
18
20
|
|
19
|
-
config.filter_run_excluding wip
|
21
|
+
config.filter_run_excluding :wip => true
|
20
22
|
|
21
23
|
config.extend AssetHelpers
|
22
24
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
module AssetHelpers
|
4
|
+
ASSETS = File.expand_path('../../fixtures/%s.html', __FILE__)
|
4
5
|
|
5
6
|
def asset name
|
6
|
-
f = fixtures[name] ||= IO.read(ASSETS%name)
|
7
|
+
f = fixtures[name] ||= IO.read(ASSETS % name)
|
7
8
|
let(:rendered) { f }
|
8
9
|
end
|
9
10
|
|
10
11
|
private
|
11
12
|
|
12
13
|
def fixtures
|
13
|
-
@
|
14
|
+
@fixtures ||= {}
|
14
15
|
end
|
15
|
-
|
16
16
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
RSpec::Matchers.define :raise_spec_error do |expected_exception_msg|
|
2
4
|
define_method :actual_msg do
|
3
5
|
@actual_msg
|
@@ -8,11 +10,11 @@ RSpec::Matchers.define :raise_spec_error do |expected_exception_msg|
|
|
8
10
|
end
|
9
11
|
|
10
12
|
match do |block|
|
11
|
-
begin
|
13
|
+
begin # rubocop:disable Style/RedundantBegin
|
12
14
|
block.call
|
13
15
|
false
|
14
|
-
rescue RSpec::Expectations::ExpectationNotMetError =>
|
15
|
-
@actual_msg =
|
16
|
+
rescue RSpec::Expectations::ExpectationNotMetError => e
|
17
|
+
@actual_msg = e.message
|
16
18
|
|
17
19
|
case expected_exception_msg
|
18
20
|
when String
|
@@ -28,9 +30,9 @@ RSpec::Matchers.define :raise_spec_error do |expected_exception_msg|
|
|
28
30
|
|
29
31
|
supports_block_expectations
|
30
32
|
|
31
|
-
failure_message do |
|
33
|
+
failure_message do |_block|
|
32
34
|
if actual_msg
|
33
|
-
<<MSG
|
35
|
+
<<MSG # rubocop:disable Layout/IndentationWidth
|
34
36
|
expected RSpec::Expectations::ExpectationNotMetError with message:
|
35
37
|
#{expected_exception_msg}
|
36
38
|
|
@@ -38,12 +40,12 @@ got:
|
|
38
40
|
#{actual_msg}
|
39
41
|
|
40
42
|
Diff:
|
41
|
-
#{RSpec::Support::Differ.new.diff_as_string(actual_msg,expected_exception_msg.to_s)}
|
43
|
+
#{RSpec::Support::Differ.new.diff_as_string(actual_msg, expected_exception_msg.to_s)}
|
42
44
|
MSG
|
43
45
|
elsif catched_exception
|
44
46
|
"expected RSpec::Expectations::ExpectationNotMetError, but was #{catched_exception.inspect}"
|
45
47
|
else
|
46
|
-
|
48
|
+
'expected RSpec::Expectations::ExpectationNotMetError, but was no exception'
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-html-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kucaahbe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -45,21 +45,35 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: cucumber
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '1'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '1'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: capybara
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '2'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: sinatra
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
64
78
|
requirements:
|
65
79
|
- - "~>"
|
@@ -73,47 +87,47 @@ dependencies:
|
|
73
87
|
- !ruby/object:Gem::Version
|
74
88
|
version: '1'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
90
|
+
name: selenium-webdriver
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
78
92
|
requirements:
|
79
93
|
- - "~>"
|
80
94
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
95
|
+
version: '3'
|
82
96
|
type: :development
|
83
97
|
prerelease: false
|
84
98
|
version_requirements: !ruby/object:Gem::Requirement
|
85
99
|
requirements:
|
86
100
|
- - "~>"
|
87
101
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
102
|
+
version: '3'
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
104
|
+
name: webdrivers
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
92
106
|
requirements:
|
93
107
|
- - "~>"
|
94
108
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
109
|
+
version: '4'
|
96
110
|
type: :development
|
97
111
|
prerelease: false
|
98
112
|
version_requirements: !ruby/object:Gem::Requirement
|
99
113
|
requirements:
|
100
114
|
- - "~>"
|
101
115
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
116
|
+
version: '4'
|
103
117
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
118
|
+
name: simplecov
|
105
119
|
requirement: !ruby/object:Gem::Requirement
|
106
120
|
requirements:
|
107
121
|
- - "~>"
|
108
122
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
123
|
+
version: '0'
|
110
124
|
type: :development
|
111
125
|
prerelease: false
|
112
126
|
version_requirements: !ruby/object:Gem::Requirement
|
113
127
|
requirements:
|
114
128
|
- - "~>"
|
115
129
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
130
|
+
version: '0'
|
117
131
|
- !ruby/object:Gem::Dependency
|
118
132
|
name: rake
|
119
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,12 +170,27 @@ dependencies:
|
|
156
170
|
- - ">="
|
157
171
|
- !ruby/object:Gem::Version
|
158
172
|
version: '0'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: rubocop
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - '='
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: 0.76.0
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - '='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: 0.76.0
|
159
187
|
description: 'Nokogiri based ''have_tag'' and ''with_tag'' matchers for rspec 3. Does
|
160
188
|
not depend on assert_select matcher, provides useful error messages.
|
161
189
|
|
162
|
-
'
|
190
|
+
'
|
163
191
|
email:
|
164
192
|
- kucaahbe@ukr.net
|
193
|
+
- randoum@gmail.com
|
165
194
|
executables: []
|
166
195
|
extensions: []
|
167
196
|
extra_rdoc_files:
|
@@ -174,13 +203,18 @@ files:
|
|
174
203
|
- features/step_definitions/steps.rb
|
175
204
|
- features/support/env.rb
|
176
205
|
- lib/rspec-html-matchers.rb
|
206
|
+
- lib/rspec-html-matchers/have_tag.rb
|
207
|
+
- lib/rspec-html-matchers/nokogiri_regexp_helper.rb
|
208
|
+
- lib/rspec-html-matchers/nokogiri_text_helper.rb
|
209
|
+
- lib/rspec-html-matchers/version.rb
|
177
210
|
- spec/form_matchers_spec.rb
|
178
211
|
- spec/have_empty_tag_spec.rb
|
179
212
|
- spec/have_tag_spec.rb
|
213
|
+
- spec/issues_spec.rb
|
180
214
|
- spec/spec_helper.rb
|
181
215
|
- spec/support/asset_helpers.rb
|
182
216
|
- spec/support/raise_spec_error_helper.rb
|
183
|
-
homepage:
|
217
|
+
homepage: https://github.com/kucaahbe/rspec-html-matchers
|
184
218
|
licenses:
|
185
219
|
- MIT
|
186
220
|
metadata: {}
|
@@ -192,26 +226,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
226
|
requirements:
|
193
227
|
- - ">="
|
194
228
|
- !ruby/object:Gem::Version
|
195
|
-
version:
|
229
|
+
version: 1.8.7
|
196
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
231
|
requirements:
|
198
232
|
- - ">="
|
199
233
|
- !ruby/object:Gem::Version
|
200
234
|
version: '0'
|
201
235
|
requirements: []
|
202
|
-
|
203
|
-
rubygems_version: 2.5.1
|
236
|
+
rubygems_version: 3.0.6
|
204
237
|
signing_key:
|
205
238
|
specification_version: 4
|
206
239
|
summary: Nokogiri based 'have_tag' and 'with_tag' matchers for rspec 3
|
207
240
|
test_files:
|
208
241
|
- spec/form_matchers_spec.rb
|
209
|
-
- spec/have_empty_tag_spec.rb
|
210
|
-
- spec/have_tag_spec.rb
|
211
242
|
- spec/spec_helper.rb
|
212
|
-
- spec/
|
243
|
+
- spec/have_empty_tag_spec.rb
|
244
|
+
- spec/issues_spec.rb
|
213
245
|
- spec/support/raise_spec_error_helper.rb
|
214
|
-
-
|
246
|
+
- spec/support/asset_helpers.rb
|
247
|
+
- spec/have_tag_spec.rb
|
215
248
|
- features/support/env.rb
|
249
|
+
- features/step_definitions/steps.rb
|
216
250
|
- features/js_generated_content.feature
|
217
|
-
has_rdoc:
|