asciidoctor-doctest 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +32 -0
  3. data/README.adoc +17 -12
  4. data/Rakefile +28 -3
  5. data/features/README +1 -0
  6. data/features/fixtures/html-slim/Rakefile +15 -0
  7. data/features/fixtures/html-slim/examples/asciidoc/block_quote.adoc +12 -0
  8. data/features/fixtures/html-slim/examples/asciidoc/document.adoc +4 -0
  9. data/features/fixtures/html-slim/examples/asciidoc/inline_quoted.adoc +2 -0
  10. data/features/fixtures/html-slim/examples/html/block_quote.html +26 -0
  11. data/features/fixtures/html-slim/examples/html/document.html +7 -0
  12. data/features/fixtures/html-slim/templates/block_paragraph.html.slim +1 -0
  13. data/features/fixtures/html-slim/templates/block_quote.html.slim +7 -0
  14. data/features/fixtures/html-slim/templates/document.html.slim +13 -0
  15. data/features/fixtures/html-slim/templates/embedded.html.slim +3 -0
  16. data/features/fixtures/html-slim/templates/inline_quoted.html.slim +8 -0
  17. data/features/fixtures/html-slim/test/html_test.rb +6 -0
  18. data/features/fixtures/html-slim/test/test_helper.rb +5 -0
  19. data/features/generator_html.feature +171 -0
  20. data/features/step_definitions/doctest_steps.rb +5 -0
  21. data/features/support/env.rb +21 -0
  22. data/features/test_html.feature +59 -0
  23. data/lib/asciidoctor/doctest/asciidoc_renderer.rb +19 -14
  24. data/lib/asciidoctor/doctest/base_example.rb +11 -5
  25. data/lib/asciidoctor/doctest/base_examples_suite.rb +1 -1
  26. data/lib/asciidoctor/doctest/generator.rb +3 -1
  27. data/lib/asciidoctor/doctest/generator_task.rb +8 -5
  28. data/lib/asciidoctor/doctest/html/example.rb +1 -1
  29. data/lib/asciidoctor/doctest/html/examples_suite.rb +2 -2
  30. data/lib/asciidoctor/doctest/minitest_diffy.rb +1 -1
  31. data/lib/asciidoctor/doctest/test.rb +4 -1
  32. data/lib/asciidoctor/doctest/version.rb +1 -1
  33. data/spec/asciidoc_renderer_spec.rb +98 -0
  34. data/spec/base_example_spec.rb +4 -1
  35. data/spec/html/examples_suite_spec.rb +5 -5
  36. data/spec/minitest_diffy_spec.rb +57 -0
  37. data/spec/shared_examples/base_examples_suite.rb +0 -20
  38. data/spec/support/fakefs.rb +19 -0
  39. metadata +151 -74
@@ -0,0 +1,57 @@
1
+ require 'active_support/core_ext/string/strip'
2
+ require 'asciidoctor/doctest/minitest_diffy'
3
+
4
+ describe Diffy::Format do
5
+
6
+ describe '#minitest' do
7
+
8
+ subject(:output) { input.minitest }
9
+ let(:input) { [] }
10
+
11
+ # This looks odd, but Diffy is actually using Format exactly like that.
12
+ # https://github.com/samg/diffy/blob/6e1f1312/lib/diffy/diff.rb#L132
13
+ before { input.extend described_class }
14
+
15
+ it { expect(described_class).to have_method :minitest }
16
+
17
+ context 'line starting with ---, or +++' do
18
+ let(:input) { ['--- a/file.rb', '+++ b/file.rb'] }
19
+
20
+ it 'discards the line' do
21
+ expect(output.chomp).to be_empty
22
+ end
23
+ end
24
+
25
+ context 'line with ""' do
26
+ let(:input) { [''] }
27
+
28
+ it 'discards this line' do
29
+ expect(output.chomp).to be_empty
30
+ end
31
+ end
32
+
33
+ context 'line starting with +' do
34
+ let(:input) { ['+ <div><p>chunky bacon</p></div>'] }
35
+
36
+ it 'replaces "+" with "A", adds padding and colour' do
37
+ is_expected.to eq "\n" + 'A <div><p>chunky bacon</p></div>'.red
38
+ end
39
+ end
40
+
41
+ context 'line starting with -' do
42
+ let(:input) { ['- <p>chunky bacon</p>'] }
43
+
44
+ it 'replaces "-" with "E", adds padding and colour' do
45
+ is_expected.to eq "\n" + 'E <p>chunky bacon</p>'.green
46
+ end
47
+ end
48
+
49
+ context 'normal lines' do
50
+ let(:input) { ['Lorem ipsum dolor', ' sit amet'] }
51
+
52
+ it 'returns the lines with padding' do
53
+ is_expected.to eq "\n Lorem ipsum dolor\n sit amet"
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,26 +1,6 @@
1
1
  require 'active_support/core_ext/array/access'
2
2
  require 'fileutils'
3
3
  require 'forwardable'
4
- require 'fakefs/spec_helpers'
5
-
6
- module FakeFS
7
- # XXX remove after merging of https://github.com/defunkt/fakefs/pull/270
8
- module FileTest
9
-
10
- def readable?(file_name)
11
- File.readable?(file_name)
12
- end
13
- module_function :readable?
14
- end
15
-
16
- # XXX remove after merging of https://github.com/defunkt/fakefs/pull/269
17
- class Pathname
18
- def read(*args)
19
- File.read(@path, *args)
20
- end
21
- end
22
- end
23
-
24
4
 
25
5
  shared_examples DocTest::BaseExamplesSuite do
26
6
  extend Forwardable
@@ -0,0 +1,19 @@
1
+ require 'fakefs/spec_helpers'
2
+
3
+ module FakeFS
4
+ # XXX remove after merging of https://github.com/defunkt/fakefs/pull/270
5
+ module FileTest
6
+
7
+ def readable?(file_name)
8
+ File.readable?(file_name)
9
+ end
10
+ module_function :readable?
11
+ end
12
+
13
+ # XXX remove after merging of https://github.com/defunkt/fakefs/pull/269
14
+ class Pathname
15
+ def read(*args)
16
+ File.read(@path, *args)
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,51 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-doctest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Jirutka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-09 00:00:00.000000000 Z
11
+ date: 2014-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
20
- type: :development
19
+ version: '4.1'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '4.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: codeclimate-test-reporter
28
+ name: asciidoctor
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.4'
34
- type: :development
33
+ version: 1.5.0
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.4'
40
+ version: 1.5.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: fakefs
42
+ name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.6'
48
- type: :development
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
@@ -53,61 +53,109 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.6'
55
55
  - !ruby/object:Gem::Dependency
56
- name: simplecov
56
+ name: diffy
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.9'
62
- type: :development
61
+ version: '3.0'
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.9'
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: htmlbeautifier
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
76
- type: :development
75
+ version: 0.0.10
76
+ type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: 0.0.10
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec
84
+ name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.1'
89
+ version: '5.4'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '5.4'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest-rg
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '5.1'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '5.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: nokogiri
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.6.3
118
+ - - "<"
119
+ - !ruby/object:Gem::Version
120
+ version: 1.6.4
121
+ type: :runtime
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: 1.6.3
128
+ - - "<"
129
+ - !ruby/object:Gem::Version
130
+ version: 1.6.4
131
+ - !ruby/object:Gem::Dependency
132
+ name: bundler
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '1.6'
90
138
  type: :development
91
139
  prerelease: false
92
140
  version_requirements: !ruby/object:Gem::Requirement
93
141
  requirements:
94
142
  - - "~>"
95
143
  - !ruby/object:Gem::Version
96
- version: '3.1'
144
+ version: '1.6'
97
145
  - !ruby/object:Gem::Dependency
98
- name: rspec-collection_matchers
146
+ name: rake
99
147
  requirement: !ruby/object:Gem::Requirement
100
148
  requirements:
101
149
  - - "~>"
102
150
  - !ruby/object:Gem::Version
103
- version: '1.1'
151
+ version: '10.0'
104
152
  type: :development
105
153
  prerelease: false
106
154
  version_requirements: !ruby/object:Gem::Requirement
107
155
  requirements:
108
156
  - - "~>"
109
157
  - !ruby/object:Gem::Version
110
- version: '1.1'
158
+ version: '10.0'
111
159
  - !ruby/object:Gem::Dependency
112
160
  name: yard
113
161
  requirement: !ruby/object:Gem::Requirement
@@ -123,136 +171,123 @@ dependencies:
123
171
  - !ruby/object:Gem::Version
124
172
  version: '0.8'
125
173
  - !ruby/object:Gem::Dependency
126
- name: activesupport
174
+ name: codeclimate-test-reporter
127
175
  requirement: !ruby/object:Gem::Requirement
128
176
  requirements:
129
177
  - - "~>"
130
178
  - !ruby/object:Gem::Version
131
- version: '4.1'
132
- type: :runtime
179
+ version: '0.4'
180
+ type: :development
133
181
  prerelease: false
134
182
  version_requirements: !ruby/object:Gem::Requirement
135
183
  requirements:
136
184
  - - "~>"
137
185
  - !ruby/object:Gem::Version
138
- version: '4.1'
186
+ version: '0.4'
139
187
  - !ruby/object:Gem::Dependency
140
- name: asciidoctor
188
+ name: fakefs
141
189
  requirement: !ruby/object:Gem::Requirement
142
190
  requirements:
143
191
  - - "~>"
144
192
  - !ruby/object:Gem::Version
145
- version: '1.5'
146
- type: :runtime
193
+ version: '0.6'
194
+ type: :development
147
195
  prerelease: false
148
196
  version_requirements: !ruby/object:Gem::Requirement
149
197
  requirements:
150
198
  - - "~>"
151
199
  - !ruby/object:Gem::Version
152
- version: '1.5'
200
+ version: '0.6'
153
201
  - !ruby/object:Gem::Dependency
154
- name: colorize
202
+ name: simplecov
155
203
  requirement: !ruby/object:Gem::Requirement
156
204
  requirements:
157
205
  - - "~>"
158
206
  - !ruby/object:Gem::Version
159
- version: '0.6'
160
- type: :runtime
207
+ version: '0.9'
208
+ type: :development
161
209
  prerelease: false
162
210
  version_requirements: !ruby/object:Gem::Requirement
163
211
  requirements:
164
212
  - - "~>"
165
213
  - !ruby/object:Gem::Version
166
- version: '0.6'
214
+ version: '0.9'
167
215
  - !ruby/object:Gem::Dependency
168
- name: diffy
216
+ name: rspec
169
217
  requirement: !ruby/object:Gem::Requirement
170
218
  requirements:
171
219
  - - "~>"
172
220
  - !ruby/object:Gem::Version
173
- version: '3.0'
174
- type: :runtime
221
+ version: '3.1'
222
+ type: :development
175
223
  prerelease: false
176
224
  version_requirements: !ruby/object:Gem::Requirement
177
225
  requirements:
178
226
  - - "~>"
179
227
  - !ruby/object:Gem::Version
180
- version: '3.0'
228
+ version: '3.1'
181
229
  - !ruby/object:Gem::Dependency
182
- name: htmlbeautifier
230
+ name: rspec-collection_matchers
183
231
  requirement: !ruby/object:Gem::Requirement
184
232
  requirements:
185
233
  - - "~>"
186
234
  - !ruby/object:Gem::Version
187
- version: '0.0'
188
- - - ">="
189
- - !ruby/object:Gem::Version
190
- version: 0.0.10
191
- type: :runtime
235
+ version: '1.1'
236
+ type: :development
192
237
  prerelease: false
193
238
  version_requirements: !ruby/object:Gem::Requirement
194
239
  requirements:
195
240
  - - "~>"
196
241
  - !ruby/object:Gem::Version
197
- version: '0.0'
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- version: 0.0.10
242
+ version: '1.1'
201
243
  - !ruby/object:Gem::Dependency
202
- name: minitest
244
+ name: aruba
203
245
  requirement: !ruby/object:Gem::Requirement
204
246
  requirements:
205
247
  - - "~>"
206
248
  - !ruby/object:Gem::Version
207
- version: '5.4'
208
- type: :runtime
249
+ version: '0.6'
250
+ type: :development
209
251
  prerelease: false
210
252
  version_requirements: !ruby/object:Gem::Requirement
211
253
  requirements:
212
254
  - - "~>"
213
255
  - !ruby/object:Gem::Version
214
- version: '5.4'
256
+ version: '0.6'
215
257
  - !ruby/object:Gem::Dependency
216
- name: nokogiri
258
+ name: cucumber
217
259
  requirement: !ruby/object:Gem::Requirement
218
260
  requirements:
219
261
  - - "~>"
220
262
  - !ruby/object:Gem::Version
221
- version: 1.6.3
222
- - - "<"
223
- - !ruby/object:Gem::Version
224
- version: 1.6.4
225
- type: :runtime
263
+ version: '1.3'
264
+ type: :development
226
265
  prerelease: false
227
266
  version_requirements: !ruby/object:Gem::Requirement
228
267
  requirements:
229
268
  - - "~>"
230
269
  - !ruby/object:Gem::Version
231
- version: 1.6.3
232
- - - "<"
233
- - !ruby/object:Gem::Version
234
- version: 1.6.4
270
+ version: '1.3'
235
271
  - !ruby/object:Gem::Dependency
236
- name: minitest-rg
272
+ name: slim
237
273
  requirement: !ruby/object:Gem::Requirement
238
274
  requirements:
239
275
  - - "~>"
240
276
  - !ruby/object:Gem::Version
241
- version: '5.1'
242
- type: :runtime
277
+ version: '2.1'
278
+ type: :development
243
279
  prerelease: false
244
280
  version_requirements: !ruby/object:Gem::Requirement
245
281
  requirements:
246
282
  - - "~>"
247
283
  - !ruby/object:Gem::Version
248
- version: '5.1'
284
+ version: '2.1'
249
285
  description: |
250
286
  A tool for end-to-end testing of Asciidoctor backends based on comparing of textual output.
251
287
  email: jakub@jirutka.cz
252
288
  executables: []
253
289
  extensions: []
254
- extra_rdoc_files:
255
- - LICENSE
290
+ extra_rdoc_files: []
256
291
  files:
257
292
  - CHANGELOG.adoc
258
293
  - LICENSE
@@ -298,6 +333,24 @@ files:
298
333
  - doc/img/doctest-diag.odf
299
334
  - doc/img/doctest-diag.svg
300
335
  - doc/img/failing-test-term.gif
336
+ - features/README
337
+ - features/fixtures/html-slim/Rakefile
338
+ - features/fixtures/html-slim/examples/asciidoc/block_quote.adoc
339
+ - features/fixtures/html-slim/examples/asciidoc/document.adoc
340
+ - features/fixtures/html-slim/examples/asciidoc/inline_quoted.adoc
341
+ - features/fixtures/html-slim/examples/html/block_quote.html
342
+ - features/fixtures/html-slim/examples/html/document.html
343
+ - features/fixtures/html-slim/templates/block_paragraph.html.slim
344
+ - features/fixtures/html-slim/templates/block_quote.html.slim
345
+ - features/fixtures/html-slim/templates/document.html.slim
346
+ - features/fixtures/html-slim/templates/embedded.html.slim
347
+ - features/fixtures/html-slim/templates/inline_quoted.html.slim
348
+ - features/fixtures/html-slim/test/html_test.rb
349
+ - features/fixtures/html-slim/test/test_helper.rb
350
+ - features/generator_html.feature
351
+ - features/step_definitions/doctest_steps.rb
352
+ - features/support/env.rb
353
+ - features/test_html.feature
301
354
  - lib/asciidoctor-doctest.rb
302
355
  - lib/asciidoctor/doctest.rb
303
356
  - lib/asciidoctor/doctest/asciidoc/examples_suite.rb
@@ -315,12 +368,15 @@ files:
315
368
  - lib/asciidoctor/doctest/test.rb
316
369
  - lib/asciidoctor/doctest/version.rb
317
370
  - spec/asciidoc/examples_suite_spec.rb
371
+ - spec/asciidoc_renderer_spec.rb
318
372
  - spec/base_example_spec.rb
319
373
  - spec/core_ext_spec.rb
320
374
  - spec/html/examples_suite_spec.rb
321
375
  - spec/html/normalizer_spec.rb
376
+ - spec/minitest_diffy_spec.rb
322
377
  - spec/shared_examples/base_examples_suite.rb
323
378
  - spec/spec_helper.rb
379
+ - spec/support/fakefs.rb
324
380
  - spec/support/matchers.rb
325
381
  - spec/test_spec.rb
326
382
  homepage: https://github.com/asciidoctor/asciidoctor-doctest
@@ -335,7 +391,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
335
391
  requirements:
336
392
  - - ">="
337
393
  - !ruby/object:Gem::Version
338
- version: '2.0'
394
+ version: '2.1'
339
395
  required_rubygems_version: !ruby/object:Gem::Requirement
340
396
  requirements:
341
397
  - - ">="
@@ -343,18 +399,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
343
399
  version: '0'
344
400
  requirements: []
345
401
  rubyforge_project:
346
- rubygems_version: 2.4.3
402
+ rubygems_version: 2.4.5
347
403
  signing_key:
348
404
  specification_version: 4
349
405
  summary: Test suite for Asciidoctor backends
350
406
  test_files:
407
+ - features/README
408
+ - features/fixtures/html-slim/Rakefile
409
+ - features/fixtures/html-slim/examples/asciidoc/block_quote.adoc
410
+ - features/fixtures/html-slim/examples/asciidoc/document.adoc
411
+ - features/fixtures/html-slim/examples/asciidoc/inline_quoted.adoc
412
+ - features/fixtures/html-slim/examples/html/block_quote.html
413
+ - features/fixtures/html-slim/examples/html/document.html
414
+ - features/fixtures/html-slim/templates/block_paragraph.html.slim
415
+ - features/fixtures/html-slim/templates/block_quote.html.slim
416
+ - features/fixtures/html-slim/templates/document.html.slim
417
+ - features/fixtures/html-slim/templates/embedded.html.slim
418
+ - features/fixtures/html-slim/templates/inline_quoted.html.slim
419
+ - features/fixtures/html-slim/test/html_test.rb
420
+ - features/fixtures/html-slim/test/test_helper.rb
421
+ - features/generator_html.feature
422
+ - features/step_definitions/doctest_steps.rb
423
+ - features/support/env.rb
424
+ - features/test_html.feature
351
425
  - spec/asciidoc/examples_suite_spec.rb
426
+ - spec/asciidoc_renderer_spec.rb
352
427
  - spec/base_example_spec.rb
353
428
  - spec/core_ext_spec.rb
354
429
  - spec/html/examples_suite_spec.rb
355
430
  - spec/html/normalizer_spec.rb
431
+ - spec/minitest_diffy_spec.rb
356
432
  - spec/shared_examples/base_examples_suite.rb
357
433
  - spec/spec_helper.rb
434
+ - spec/support/fakefs.rb
358
435
  - spec/support/matchers.rb
359
436
  - spec/test_spec.rb
360
437
  has_rdoc: yard