be_valid_asset 1.1.2 → 1.2.0
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.
- data/MIT-LICENSE.txt +2 -2
- data/README.markdown +11 -11
- data/lib/be_valid_asset.rb +1 -0
- data/lib/be_valid_asset/be_valid_base.rb +1 -1
- data/lib/be_valid_asset/be_valid_xhtml.rb +3 -60
- data/spec/be_valid_asset/be_valid_css_spec.rb +3 -3
- data/spec/be_valid_asset/be_valid_feed_spec.rb +3 -3
- data/spec/be_valid_asset/{be_valid_xhtml_spec.rb → be_valid_markup_spec.rb} +55 -44
- data/spec/files/valid.html5 +14 -0
- data/spec/spec_helper.rb +7 -3
- metadata +9 -8
data/MIT-LICENSE.txt
CHANGED
@@ -13,8 +13,8 @@ included in all copies or substantial portions of the Software.
|
|
13
13
|
|
14
14
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
17
|
-
NONINFRINGEMENT. IN NO EVENT
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
be\_valid\_asset
|
2
2
|
==============
|
3
3
|
|
4
|
-
Provides `
|
4
|
+
Provides `be_valid_markup`, `be_valid_css` and `be_valid_feed` matchers for rspec controller and view tests.
|
5
5
|
|
6
6
|
Installation
|
7
7
|
------------
|
@@ -28,7 +28,7 @@ See below for details of the configuration options available
|
|
28
28
|
Usage
|
29
29
|
-----
|
30
30
|
|
31
|
-
###
|
31
|
+
### Markup validation
|
32
32
|
|
33
33
|
It can be used to test either an ActionController Response object as follows:
|
34
34
|
|
@@ -38,7 +38,7 @@ It can be used to test either an ActionController Response object as follows:
|
|
38
38
|
describe "GET 'index'" do
|
39
39
|
it "should have valid markup" do
|
40
40
|
get 'index'
|
41
|
-
response.should
|
41
|
+
response.should be_valid_markup
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -46,24 +46,24 @@ It can be used to test either an ActionController Response object as follows:
|
|
46
46
|
or
|
47
47
|
|
48
48
|
describe "/index.html" do
|
49
|
-
it "should be valid
|
49
|
+
it "should be valid markup" do
|
50
50
|
render 'home/index', :layout => true
|
51
|
-
response.should
|
51
|
+
response.should be_valid_markup
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
or to test a string:
|
56
56
|
|
57
|
-
it "should be valid
|
57
|
+
it "should be valid markup" do
|
58
58
|
html = File.read(File.join(RAILS_ROOT, %w(public index.html)))
|
59
|
-
html.should
|
59
|
+
html.should be_valid_markup
|
60
60
|
end
|
61
61
|
|
62
|
-
It is also possible to validate an
|
62
|
+
It is also possible to validate an html fragment. This assumes xhtml-1.0 strict.
|
63
63
|
|
64
|
-
it "should be valid
|
64
|
+
it "should be valid html" do
|
65
65
|
string = "<p>This is an html fragment</p>"
|
66
|
-
string.should
|
66
|
+
string.should be_valid_markup_fragment
|
67
67
|
end
|
68
68
|
|
69
69
|
### CSS validation
|
@@ -83,7 +83,7 @@ be\_valid\_css takes an optional parameter specifying the css profile to test ag
|
|
83
83
|
|
84
84
|
### Feed validation
|
85
85
|
|
86
|
-
RSS and Atom feeds can be validated from a response, or a string, in the same way as for
|
86
|
+
RSS and Atom feeds can be validated from a response, or a string, in the same way as for html or CSS. e.g.
|
87
87
|
|
88
88
|
describe FooController do
|
89
89
|
integrate_views
|
data/lib/be_valid_asset.rb
CHANGED
@@ -1,68 +1,11 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'cgi'
|
4
|
-
require 'digest/md5'
|
5
|
-
require 'rexml/document'
|
6
|
-
|
7
1
|
module BeValidAsset
|
8
2
|
|
9
|
-
|
10
|
-
Configuration.markup_validator_path = '/check'
|
11
|
-
|
12
|
-
class BeValidXhtml < BeValidBase
|
3
|
+
class BeValidXhtml < BeValidMarkup
|
13
4
|
|
14
5
|
def initialize(options = {})
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# Assert that markup (html/xhtml) is valid according the W3C validator web service.
|
19
|
-
|
20
|
-
def matches?(fragment)
|
21
|
-
|
22
|
-
if fragment.respond_to? :body
|
23
|
-
fragment = fragment.body.to_s
|
24
|
-
end
|
25
|
-
|
26
|
-
if fragment.empty?
|
27
|
-
@message = "Response was blank (maybe a missing integrate_views)"
|
28
|
-
return false
|
29
|
-
end
|
30
|
-
|
31
|
-
query_params = { :fragment => fragment }
|
32
|
-
if @fragment
|
33
|
-
query_params[:prefill] = '1'
|
34
|
-
query_params[:prefill_doctype] = 'xhtml10'
|
35
|
-
end
|
36
|
-
|
37
|
-
return validate(query_params)
|
38
|
-
end
|
39
|
-
|
40
|
-
def description
|
41
|
-
"be valid xhtml"
|
6
|
+
super
|
7
|
+
Kernel.warn('[DEPRECATION] - `be_valid_xhtml` is deprecated, use `be_valid_markup` instead')
|
42
8
|
end
|
43
|
-
|
44
|
-
def failure_message
|
45
|
-
" expected xhtml to be valid, but validation produced these errors:\n#{@message}"
|
46
|
-
end
|
47
|
-
|
48
|
-
def negative_failure_message
|
49
|
-
" expected to not be valid, but was (missing validation?)"
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def validator_host
|
55
|
-
Configuration.markup_validator_host
|
56
|
-
end
|
57
|
-
|
58
|
-
def validator_path
|
59
|
-
Configuration.markup_validator_path
|
60
|
-
end
|
61
|
-
|
62
|
-
def error_line_prefix
|
63
|
-
'Invalid markup'
|
64
|
-
end
|
65
|
-
|
66
9
|
end
|
67
10
|
|
68
11
|
def be_valid_xhtml
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
unless defined?(SpecFailed)
|
4
|
-
SpecFailed =
|
4
|
+
SpecFailed = RSpec::Expectations::ExpectationNotMetError
|
5
5
|
end
|
6
6
|
|
7
7
|
describe 'be_valid_css' do
|
@@ -76,7 +76,7 @@ describe 'be_valid_css' do
|
|
76
76
|
css = get_file('valid.css')
|
77
77
|
lambda {
|
78
78
|
css.should be_valid_css
|
79
|
-
}.should raise_error(
|
79
|
+
}.should raise_error(RSpec::Core::Pending::PendingDeclaredInExample)
|
80
80
|
|
81
81
|
ENV.delete('NONET')
|
82
82
|
end
|
@@ -187,7 +187,7 @@ describe 'be_valid_css' do
|
|
187
187
|
css = get_file('valid.css')
|
188
188
|
lambda {
|
189
189
|
css.should be_valid_css
|
190
|
-
}.should raise_error(
|
190
|
+
}.should raise_error(RSpec::Core::Pending::PendingDeclaredInExample)
|
191
191
|
|
192
192
|
ENV.delete('NONET')
|
193
193
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
unless defined?(SpecFailed)
|
4
|
-
SpecFailed =
|
4
|
+
SpecFailed = RSpec::Expectations::ExpectationNotMetError
|
5
5
|
end
|
6
6
|
|
7
7
|
describe 'be_valid_feed' do
|
@@ -82,7 +82,7 @@ describe 'be_valid_feed' do
|
|
82
82
|
feed = get_file('valid_feed.xml')
|
83
83
|
lambda {
|
84
84
|
feed.should be_valid_feed
|
85
|
-
}.should raise_error(
|
85
|
+
}.should raise_error(RSpec::Core::Pending::PendingDeclaredInExample)
|
86
86
|
|
87
87
|
ENV.delete('NONET')
|
88
88
|
end
|
@@ -170,7 +170,7 @@ describe 'be_valid_feed' do
|
|
170
170
|
feed = get_file('valid_feed.xml')
|
171
171
|
lambda {
|
172
172
|
feed.should be_valid_feed
|
173
|
-
}.should raise_error(
|
173
|
+
}.should raise_error(RSpec::Core::Pending::PendingDeclaredInExample)
|
174
174
|
|
175
175
|
ENV.delete('NONET')
|
176
176
|
end
|
@@ -1,37 +1,52 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
unless defined?(SpecFailed)
|
4
|
-
SpecFailed =
|
4
|
+
SpecFailed = RSpec::Expectations::ExpectationNotMetError
|
5
5
|
end
|
6
6
|
|
7
|
-
describe '
|
7
|
+
describe 'be_valid_markup' do
|
8
8
|
|
9
9
|
describe "without caching" do
|
10
10
|
it "should validate a valid string" do
|
11
11
|
html = get_file('valid.html')
|
12
|
-
html.should
|
12
|
+
html.should be_valid_markup
|
13
13
|
end
|
14
14
|
|
15
|
-
it "should validate a valid response" do
|
15
|
+
it "should validate a valid xhtml response" do
|
16
16
|
response = MockResponse.new(get_file('valid.html'))
|
17
|
-
response.should
|
17
|
+
response.should be_valid_markup
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should validate a valid html5 response" do
|
21
|
+
response = MockResponse.new(get_file('valid.html5'))
|
22
|
+
response.should be_valid_markup
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should validate a valid html5 response when only 'source' is available" do
|
26
|
+
response = mock(:source => get_file('valid.html5'))
|
27
|
+
response.should be_valid_markup
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should validate a valid html5 response when only 'body' is available" do
|
31
|
+
response = mock(:body => get_file('valid.html5'))
|
32
|
+
response.should be_valid_markup
|
18
33
|
end
|
19
34
|
|
20
35
|
it "should validate if body is not a string but can be converted to valid string" do
|
21
36
|
response = MockResponse.new(stub("XHTML", :to_s => get_file('valid.html')))
|
22
|
-
response.should
|
37
|
+
response.should be_valid_markup
|
23
38
|
end
|
24
39
|
|
25
40
|
it "should validate a valid fragment" do
|
26
|
-
"<p>This is a Fragment</p>".should
|
41
|
+
"<p>This is a Fragment</p>".should be_valid_markup_fragment
|
27
42
|
end
|
28
43
|
|
29
44
|
it "should not validate an invalid string" do
|
30
45
|
html = get_file('invalid.html')
|
31
46
|
lambda {
|
32
|
-
html.should
|
47
|
+
html.should be_valid_markup
|
33
48
|
}.should raise_error(SpecFailed) { |e|
|
34
|
-
e.message.should match(/expected
|
49
|
+
e.message.should match(/expected markup to be valid, but validation produced these errors/)
|
35
50
|
e.message.should match(/Invalid markup: line 12: end tag for "b" omitted, but OMITTAG NO was specified/)
|
36
51
|
e.message.should match(/Invalid markup: line 12: end tag for element "b" which is not open/)
|
37
52
|
}
|
@@ -40,9 +55,9 @@ describe 'be_valid_xhtml' do
|
|
40
55
|
it "should not validate an invalid response" do
|
41
56
|
response = MockResponse.new(get_file('invalid.html'))
|
42
57
|
lambda {
|
43
|
-
response.should
|
58
|
+
response.should be_valid_markup
|
44
59
|
}.should raise_error(SpecFailed) { |e|
|
45
|
-
e.message.should match(/expected
|
60
|
+
e.message.should match(/expected markup to be valid, but validation produced these errors/)
|
46
61
|
e.message.should match(/Invalid markup: line 12: end tag for "b" omitted, but OMITTAG NO was specified/)
|
47
62
|
e.message.should match(/Invalid markup: line 12: end tag for element "b" which is not open/)
|
48
63
|
}
|
@@ -52,7 +67,7 @@ describe 'be_valid_xhtml' do
|
|
52
67
|
BeValidAsset::Configuration.display_invalid_content = true
|
53
68
|
html = get_file('invalid.html')
|
54
69
|
lambda {
|
55
|
-
html.should
|
70
|
+
html.should be_valid_markup
|
56
71
|
}.should raise_error(SpecFailed) { |e|
|
57
72
|
e.message.should match(/<p><b>This is an example invalid html file<\/p><\/b>/)
|
58
73
|
}
|
@@ -71,9 +86,9 @@ describe 'be_valid_xhtml' do
|
|
71
86
|
it "should display invalid lines when requested" do
|
72
87
|
html = get_file('invalid.html')
|
73
88
|
lambda do
|
74
|
-
html.should
|
89
|
+
html.should be_valid_markup
|
75
90
|
end.should raise_error(SpecFailed) { |e|
|
76
|
-
e.message.should match(/expected
|
91
|
+
e.message.should match(/expected markup to be valid, but validation produced these errors/)
|
77
92
|
e.message.should_not match(/0009 :/)
|
78
93
|
e.message.should match(/0010 :/)
|
79
94
|
e.message.should match(/0011 :/)
|
@@ -88,9 +103,9 @@ describe 'be_valid_xhtml' do
|
|
88
103
|
BeValidAsset::Configuration.display_invalid_lines_count = 3
|
89
104
|
html = get_file('invalid.html')
|
90
105
|
lambda do
|
91
|
-
html.should
|
106
|
+
html.should be_valid_markup
|
92
107
|
end.should raise_error(SpecFailed) { |e|
|
93
|
-
e.message.should match(/expected
|
108
|
+
e.message.should match(/expected markup to be valid, but validation produced these errors/)
|
94
109
|
e.message.should_not match(/0010 :/)
|
95
110
|
e.message.should match(/0011 :/)
|
96
111
|
e.message.should match(/0012>>:/)
|
@@ -103,9 +118,9 @@ describe 'be_valid_xhtml' do
|
|
103
118
|
BeValidAsset::Configuration.display_invalid_lines_count = 7
|
104
119
|
html = get_file('invalid2.html')
|
105
120
|
lambda do
|
106
|
-
html.should
|
121
|
+
html.should be_valid_markup
|
107
122
|
end.should raise_error(SpecFailed) { |e|
|
108
|
-
e.message.should match(/expected
|
123
|
+
e.message.should match(/expected markup to be valid, but validation produced these errors/)
|
109
124
|
e.message.should_not match(/0000 :/)
|
110
125
|
e.message.should match(/0001 :/)
|
111
126
|
e.message.should match(/0003>>:/)
|
@@ -116,9 +131,9 @@ describe 'be_valid_xhtml' do
|
|
116
131
|
BeValidAsset::Configuration.display_invalid_lines_count = 11
|
117
132
|
html = get_file('invalid.html')
|
118
133
|
lambda do
|
119
|
-
html.should
|
134
|
+
html.should be_valid_markup
|
120
135
|
end.should raise_error(SpecFailed) { |e|
|
121
|
-
e.message.should match(/expected
|
136
|
+
e.message.should match(/expected markup to be valid, but validation produced these errors/)
|
122
137
|
e.message.should match(/0012>>:/)
|
123
138
|
e.message.should match(/0015 :/)
|
124
139
|
e.message.should_not match(/0016 :/)
|
@@ -129,7 +144,7 @@ describe 'be_valid_xhtml' do
|
|
129
144
|
it "should fail when passed a response with a blank body" do
|
130
145
|
response = MockResponse.new('')
|
131
146
|
lambda {
|
132
|
-
response.should
|
147
|
+
response.should be_valid_markup
|
133
148
|
}.should raise_error(SpecFailed)
|
134
149
|
end
|
135
150
|
|
@@ -142,7 +157,7 @@ describe 'be_valid_xhtml' do
|
|
142
157
|
Net::HTTP.stub!(:start).and_return(h)
|
143
158
|
|
144
159
|
lambda {
|
145
|
-
html.should
|
160
|
+
html.should be_valid_markup
|
146
161
|
}.should raise_error
|
147
162
|
end
|
148
163
|
|
@@ -151,8 +166,8 @@ describe 'be_valid_xhtml' do
|
|
151
166
|
|
152
167
|
html = get_file('valid.html')
|
153
168
|
lambda {
|
154
|
-
html.should
|
155
|
-
}.should raise_error(
|
169
|
+
html.should be_valid_markup
|
170
|
+
}.should raise_error(RSpec::Core::Pending::PendingDeclaredInExample)
|
156
171
|
|
157
172
|
ENV.delete('NONET')
|
158
173
|
end
|
@@ -170,25 +185,25 @@ describe 'be_valid_xhtml' do
|
|
170
185
|
it "should validate a valid string and cache the response" do
|
171
186
|
html = get_file('valid.html')
|
172
187
|
count = Dir.glob(BeValidAsset::Configuration.cache_path + '/*').size
|
173
|
-
html.should
|
188
|
+
html.should be_valid_markup
|
174
189
|
Dir.glob(BeValidAsset::Configuration.cache_path + '/*').size.should eql(count + 1)
|
175
190
|
end
|
176
191
|
|
177
192
|
it "should validate a valid string using the cached response" do
|
178
193
|
html = get_file('valid.html')
|
179
|
-
html.should
|
194
|
+
html.should be_valid_markup
|
180
195
|
|
181
196
|
Net::HTTP.should_not_receive(:start)
|
182
|
-
html.should
|
197
|
+
html.should be_valid_markup
|
183
198
|
end
|
184
199
|
|
185
200
|
it "should not validate an invalid response, but still cache the response" do
|
186
201
|
response = MockResponse.new(get_file('invalid.html'))
|
187
202
|
count = Dir.glob(BeValidAsset::Configuration.cache_path + '/*').size
|
188
203
|
lambda {
|
189
|
-
response.should
|
204
|
+
response.should be_valid_markup
|
190
205
|
}.should raise_error(SpecFailed) { |e|
|
191
|
-
e.message.should match(/expected
|
206
|
+
e.message.should match(/expected markup to be valid, but validation produced these errors/)
|
192
207
|
e.message.should match(/Invalid markup: line 12: end tag for "b" omitted, but OMITTAG NO was specified/)
|
193
208
|
e.message.should match(/Invalid markup: line 12: end tag for element "b" which is not open/)
|
194
209
|
}
|
@@ -197,13 +212,13 @@ describe 'be_valid_xhtml' do
|
|
197
212
|
|
198
213
|
it "should not validate an invalid response, but use the cached response" do
|
199
214
|
response = MockResponse.new(get_file('invalid.html'))
|
200
|
-
response.should_not
|
215
|
+
response.should_not be_valid_markup
|
201
216
|
|
202
217
|
Net::HTTP.should_not_receive(:start)
|
203
218
|
lambda {
|
204
|
-
response.should
|
219
|
+
response.should be_valid_markup
|
205
220
|
}.should raise_error(SpecFailed) { |e|
|
206
|
-
e.message.should match(/expected
|
221
|
+
e.message.should match(/expected markup to be valid, but validation produced these errors/)
|
207
222
|
e.message.should match(/Invalid markup: line 12: end tag for "b" omitted, but OMITTAG NO was specified/)
|
208
223
|
e.message.should match(/Invalid markup: line 12: end tag for element "b" which is not open/)
|
209
224
|
}
|
@@ -219,19 +234,19 @@ describe 'be_valid_xhtml' do
|
|
219
234
|
Net::HTTP.stub!(:start).and_return(h)
|
220
235
|
|
221
236
|
lambda {
|
222
|
-
html.should
|
237
|
+
html.should be_valid_markup
|
223
238
|
}.should raise_error
|
224
239
|
Dir.glob(BeValidAsset::Configuration.cache_path + '/*').size.should eql(count)
|
225
240
|
end
|
226
241
|
|
227
242
|
it "should use the cached result (if available) when network tests disabled" do
|
228
243
|
html = get_file('valid.html')
|
229
|
-
html.should
|
244
|
+
html.should be_valid_markup
|
230
245
|
|
231
246
|
ENV['NONET'] = 'true'
|
232
247
|
|
233
248
|
Net::HTTP.should_not_receive(:start)
|
234
|
-
html.should
|
249
|
+
html.should be_valid_markup
|
235
250
|
|
236
251
|
ENV.delete('NONET')
|
237
252
|
end
|
@@ -241,8 +256,8 @@ describe 'be_valid_xhtml' do
|
|
241
256
|
|
242
257
|
html = get_file('valid.html')
|
243
258
|
lambda {
|
244
|
-
html.should
|
245
|
-
}.should raise_error(
|
259
|
+
html.should be_valid_markup
|
260
|
+
}.should raise_error(RSpec::Core::Pending::PendingDeclaredInExample)
|
246
261
|
|
247
262
|
ENV.delete('NONET')
|
248
263
|
end
|
@@ -261,26 +276,22 @@ describe 'be_valid_xhtml' do
|
|
261
276
|
it "should use direct http without ENV['http_proxy']" do
|
262
277
|
ENV.delete('http_proxy')
|
263
278
|
Net::HTTP.should_receive(:start).with(BeValidAsset::Configuration.markup_validator_host).and_return(@http)
|
264
|
-
@html.should
|
279
|
+
@html.should be_valid_markup
|
265
280
|
end
|
266
281
|
|
267
282
|
it "should use proxied http connection with ENV['http_proxy']" do
|
268
283
|
ENV['http_proxy'] = "http://user:pw@localhost:3128"
|
269
284
|
Net::HTTP.should_receive(:start).with(BeValidAsset::Configuration.markup_validator_host, nil, 'localhost', 3128, "user", "pw").and_return(@http)
|
270
|
-
@html.should
|
285
|
+
@html.should be_valid_markup
|
271
286
|
ENV.delete('http_proxy')
|
272
287
|
end
|
273
288
|
|
274
289
|
it "should raise exception with invalid http_proxy" do
|
275
290
|
ENV['http_proxy'] = "http://invalid:uri"
|
276
291
|
lambda {
|
277
|
-
@html.should
|
292
|
+
@html.should be_valid_markup
|
278
293
|
}.should raise_error(URI::InvalidURIError)
|
279
294
|
ENV.delete('http_proxy')
|
280
295
|
end
|
281
296
|
end
|
282
|
-
|
283
|
-
it "should have a be_valid_html alias method" do
|
284
|
-
method(:be_valid_html).should == method(:be_valid_xhtml)
|
285
|
-
end
|
286
297
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
5
|
+
<title>Test Valid Page</title>
|
6
|
+
</head>
|
7
|
+
|
8
|
+
<body>
|
9
|
+
|
10
|
+
<h1>Test#valid</h1>
|
11
|
+
<p>This is an example valid html5 file</p>
|
12
|
+
<br>
|
13
|
+
</body>
|
14
|
+
</html>
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'rspec'
|
3
3
|
|
4
4
|
begin
|
5
5
|
require 'ruby-debug'
|
@@ -10,7 +10,7 @@ $: << File.join(File.dirname(__FILE__), %w(.. lib))
|
|
10
10
|
|
11
11
|
require 'be_valid_asset'
|
12
12
|
|
13
|
-
|
13
|
+
RSpec.configure do |config|
|
14
14
|
config.include BeValidAsset
|
15
15
|
|
16
16
|
BeValidAsset::Configuration.cache_path = File.join(File.dirname(__FILE__), 'tmp')
|
@@ -23,10 +23,14 @@ end
|
|
23
23
|
|
24
24
|
class MockResponse
|
25
25
|
def initialize(body_text)
|
26
|
-
@body = body_text
|
26
|
+
@source = @body = body_text
|
27
27
|
end
|
28
28
|
|
29
29
|
def body
|
30
30
|
@body
|
31
31
|
end
|
32
|
+
|
33
|
+
def source
|
34
|
+
@source
|
35
|
+
end
|
32
36
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: be_valid_asset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 1
|
9
8
|
- 2
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Tomlins
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date:
|
20
|
+
date: 2012-05-30 00:00:00 +01:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -53,7 +53,7 @@ files:
|
|
53
53
|
- lib/be_valid_asset.rb
|
54
54
|
- spec/be_valid_asset/be_valid_css_spec.rb
|
55
55
|
- spec/be_valid_asset/be_valid_feed_spec.rb
|
56
|
-
- spec/be_valid_asset/
|
56
|
+
- spec/be_valid_asset/be_valid_markup_spec.rb
|
57
57
|
- spec/spec_helper.rb
|
58
58
|
- spec/files/invalid.css
|
59
59
|
- spec/files/invalid.html
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- spec/files/valid-3.css
|
65
65
|
- spec/files/valid.css
|
66
66
|
- spec/files/valid.html
|
67
|
+
- spec/files/valid.html5
|
67
68
|
- spec/files/valid_feed.xml
|
68
69
|
- spec/spec.opts
|
69
70
|
has_rdoc: true
|
@@ -96,11 +97,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
97
|
requirements: []
|
97
98
|
|
98
99
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.
|
100
|
+
rubygems_version: 1.4.2
|
100
101
|
signing_key:
|
101
102
|
specification_version: 3
|
102
103
|
summary: Markup validation for RSpec
|
103
104
|
test_files:
|
104
105
|
- spec/be_valid_asset/be_valid_css_spec.rb
|
105
106
|
- spec/be_valid_asset/be_valid_feed_spec.rb
|
106
|
-
- spec/be_valid_asset/
|
107
|
+
- spec/be_valid_asset/be_valid_markup_spec.rb
|