asciidoctor-doctest 2.0.0.beta.4 → 2.0.0.beta.5
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.adoc +58 -0
- data/LICENSE +21 -0
- data/README.adoc +310 -0
- data/asciidoctor-doctest.gemspec +48 -0
- data/data/examples/asciidoc/embedded.adoc +15 -0
- data/data/examples/asciidoc/preamble.adoc +1 -2
- data/data/examples/asciidoc/section.adoc +9 -0
- data/data/examples/asciidoc/toc.adoc +21 -9
- data/lib/asciidoctor/doctest/html/converter.rb +1 -1
- data/lib/asciidoctor/doctest/io/asciidoc.rb +2 -3
- data/lib/asciidoctor/doctest/io/base.rb +1 -1
- data/lib/asciidoctor/doctest/io/xml.rb +1 -1
- data/lib/asciidoctor/doctest/test_reporter.rb +3 -3
- data/lib/asciidoctor/doctest/version.rb +1 -1
- metadata +20 -69
- data/doc/img/doctest-diag.odf +0 -0
- data/doc/img/doctest-diag.svg +0 -56
- data/doc/img/failing-test-term.gif +0 -0
- data/features/README +0 -1
- data/features/fixtures/html-slim/Rakefile +0 -9
- data/features/fixtures/html-slim/examples/asciidoc/document.adoc +0 -4
- data/features/fixtures/html-slim/examples/asciidoc/inline_quoted.adoc +0 -2
- data/features/fixtures/html-slim/examples/asciidoc/quote.adoc +0 -12
- data/features/fixtures/html-slim/examples/html/document.html +0 -7
- data/features/fixtures/html-slim/examples/html/quote.html +0 -26
- data/features/fixtures/html-slim/templates/document.html.slim +0 -13
- data/features/fixtures/html-slim/templates/embedded.html.slim +0 -3
- data/features/fixtures/html-slim/templates/inline_quoted.html.slim +0 -8
- data/features/fixtures/html-slim/templates/paragraph.html.slim +0 -1
- data/features/fixtures/html-slim/templates/quote.html.slim +0 -7
- data/features/generator_html.feature +0 -171
- data/features/step_definitions/doctest_steps.rb +0 -5
- data/features/support/env.rb +0 -24
- data/features/test_html.feature +0 -98
- data/spec/asciidoc_converter_spec.rb +0 -64
- data/spec/example_spec.rb +0 -180
- data/spec/factory_spec.rb +0 -46
- data/spec/html/converter_spec.rb +0 -137
- data/spec/html_normalizer_spec.rb +0 -70
- data/spec/io/asciidoc_spec.rb +0 -139
- data/spec/io/xml_spec.rb +0 -141
- data/spec/minitest_diffy_spec.rb +0 -59
- data/spec/no_fallback_template_converter_spec.rb +0 -38
- data/spec/shared_examples/base_examples.rb +0 -289
- data/spec/spec_helper.rb +0 -39
- data/spec/support/matchers.rb +0 -7
- data/spec/tester_spec.rb +0 -153
data/spec/factory_spec.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
|
3
|
-
describe DocTest::Factory do
|
4
|
-
|
5
|
-
subject(:factory) { Module.new { extend DocTest::Factory } }
|
6
|
-
|
7
|
-
let(:default_opts) { {} }
|
8
|
-
|
9
|
-
before do
|
10
|
-
factory.register(:foo, OpenStruct, default_opts)
|
11
|
-
factory.register(:bar, String, 'illegal')
|
12
|
-
factory.register(:baz, Integer)
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '.create' do
|
16
|
-
it "returns instance of registered class" do
|
17
|
-
expect( factory.create(:foo) ).to eq OpenStruct.new
|
18
|
-
end
|
19
|
-
|
20
|
-
context "with opts" do
|
21
|
-
it "initializes class with opts" do
|
22
|
-
expect( factory.create(:foo, a: 42) ).to eq OpenStruct.new(a: 42)
|
23
|
-
end
|
24
|
-
|
25
|
-
context "when class with default_opts" do
|
26
|
-
let(:default_opts) { {a: 1, b: 2} }
|
27
|
-
|
28
|
-
it "initializes class with opts merged with default_opts" do
|
29
|
-
expect( factory.create(:foo, b: 6) ).to eq OpenStruct.new(a: 1, b: 6)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context "when class with default_opts" do
|
35
|
-
let(:default_opts) { {a: 1, b: 2} }
|
36
|
-
|
37
|
-
it "initializes class with default_opts" do
|
38
|
-
expect( factory.create(:foo) ).to eq OpenStruct.new(default_opts)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context "with unregistered name" do
|
43
|
-
it { expect { factory.create(:unknown) }.to raise_error(ArgumentError) }
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/spec/html/converter_spec.rb
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
|
3
|
-
using Corefines::String::unindent
|
4
|
-
|
5
|
-
module DocTest
|
6
|
-
describe HTML::Converter do
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def_delegator :converter, :convert_examples
|
10
|
-
|
11
|
-
subject(:converter) { described_class.new }
|
12
|
-
|
13
|
-
describe '#convert_examples' do
|
14
|
-
|
15
|
-
let(:input) { Example.new 's:dummy', content: '*chunky* bacon', opts: input_opts }
|
16
|
-
let(:input_opts) { {} }
|
17
|
-
let(:output) { Example.new 's:dummy', content: output_content, opts: output_opts }
|
18
|
-
let(:output_content) { '<b>chunky</b> bacon' }
|
19
|
-
let(:output_opts) { {dummy: 'value'} }
|
20
|
-
let(:converter_opts) { {header_footer: false} }
|
21
|
-
|
22
|
-
subject(:result) { convert_examples input, output }
|
23
|
-
|
24
|
-
let :rendered do
|
25
|
-
<<-EOF
|
26
|
-
<section>
|
27
|
-
<h1>Title</h1>
|
28
|
-
<div>
|
29
|
-
<p><b>Chunky</b> bacon</p>
|
30
|
-
</div>
|
31
|
-
<code>meh</code>
|
32
|
-
</section>
|
33
|
-
<div>
|
34
|
-
<p>why?</p>
|
35
|
-
</div>
|
36
|
-
EOF
|
37
|
-
end
|
38
|
-
|
39
|
-
before do
|
40
|
-
expect(converter).to receive(:convert)
|
41
|
-
.with(input.content, converter_opts).and_return(rendered)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'returns array of converted input content and output content'
|
45
|
-
|
46
|
-
context 'with :exclude option' do
|
47
|
-
let(:output_opts) { {exclude: ['.//p', './/code']} }
|
48
|
-
|
49
|
-
it 'returns content without HTML (sub)elements specified by XPath' do
|
50
|
-
expect(result.first.gsub(/\s*/, '')).to eq \
|
51
|
-
'<section><h1>Title</h1><div></div></section><div></div>'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context 'with :include option' do
|
56
|
-
let(:output_opts) { {include: ['.//p']} }
|
57
|
-
|
58
|
-
it 'returns content with only HTML (sub)elements specified by XPath' do
|
59
|
-
expect(result.first.gsub(/\s*/, '')).to eq '<p><b>Chunky</b>bacon</p><p>why?</p>'
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'with :header_footer option' do
|
64
|
-
let(:converter_opts) { {header_footer: true} }
|
65
|
-
|
66
|
-
context 'specified in output example' do
|
67
|
-
let(:output_opts) { {header_footer: true} }
|
68
|
-
|
69
|
-
it 'renders content with :header_footer => true' do
|
70
|
-
convert_examples input, output
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
context 'specified in input example' do
|
75
|
-
let(:input_opts) { {header_footer: true} }
|
76
|
-
|
77
|
-
it 'renders content with :header_footer => true' do
|
78
|
-
convert_examples input, output
|
79
|
-
end
|
80
|
-
|
81
|
-
context 'and disabled in output example' do
|
82
|
-
let(:output_opts) { {header_footer: false} }
|
83
|
-
let(:converter_opts) { {header_footer: false} }
|
84
|
-
|
85
|
-
it 'renders content with :header_footer => false' do
|
86
|
-
convert_examples input, output
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'with example named /^document.*/' do
|
93
|
-
let(:input) { Example.new 'document:dummy', content: '*chunky* bacon' }
|
94
|
-
let(:converter_opts) { {header_footer: true} }
|
95
|
-
|
96
|
-
it 'renders content with :header_footer => true' do
|
97
|
-
convert_examples input, output
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
context 'with example named /inline_.*/' do
|
102
|
-
let(:input) { Example.new 'inline_quoted:dummy', content: '*chunky* bacon' }
|
103
|
-
let(:rendered) { '<p><b>chunky</b> bacon</p>' }
|
104
|
-
|
105
|
-
it 'returns content without top-level <p> tags' do
|
106
|
-
expect(result.first).to eq '<b>chunky</b> bacon'
|
107
|
-
end
|
108
|
-
|
109
|
-
context 'with :include option' do
|
110
|
-
let(:output_opts) { {include: ['.//b']} }
|
111
|
-
|
112
|
-
it 'preferes the include option' do
|
113
|
-
expect(result.first).to eq '<b>chunky</b>'
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
context 'with output example including DOCTYPE' do
|
119
|
-
let :output_content do
|
120
|
-
<<-EOF.unindent.strip
|
121
|
-
<!DOCTYPE html>
|
122
|
-
<html>
|
123
|
-
<head>
|
124
|
-
<title>Test</title>
|
125
|
-
</head>
|
126
|
-
<body></body>
|
127
|
-
</html>
|
128
|
-
EOF
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'returns expected content with DOCTYPE' do
|
132
|
-
expect(result.last).to eq output_content
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
describe DocTest::HtmlNormalizer do
|
2
|
-
|
3
|
-
[Nokogiri::HTML::Document, Nokogiri::HTML::DocumentFragment].each do |klass|
|
4
|
-
it "HtmlNormalizer should be included in #{klass}" do
|
5
|
-
expect(klass).to have_method :normalize!
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
describe 'normalize!' do
|
10
|
-
|
11
|
-
it 'sorts attributes by name' do
|
12
|
-
output = normalize '<img src="tux.png" width="60" height="100" alt="Tux!">'
|
13
|
-
expect(output).to eq '<img alt="Tux!" height="100" src="tux.png" width="60">'
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'removes all blank text nodes' do
|
17
|
-
output = normalize " <section>\n <p>Lorem ipsum</p>\n\t</section>\n\n"
|
18
|
-
expect(output).to eq '<section><p>Lorem ipsum</p></section>'
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'in "style" attribute' do
|
22
|
-
|
23
|
-
it 'sorts CSS declarations by name' do
|
24
|
-
output = normalize %(<div style="width: 100%; color: 'red'; font-style: bold"></div>)
|
25
|
-
expect(output).to eq %(<div style="color: 'red'; font-style: bold; width: 100%;"></div>)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'in text node' do
|
30
|
-
|
31
|
-
it 'strips nonsignificant leading and trailing whitespaces' do
|
32
|
-
output = normalize "<p> Lorem<b> ipsum</b> dolor\n<br> sit <i>amet</i></p>"
|
33
|
-
expect(output).to eq '<p>Lorem<b> ipsum</b> dolor<br>sit <i>amet</i></p>'
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'strips nonsignificant repeated whitespaces' do
|
37
|
-
output = normalize "<p>Lorem ipsum\t\tdolor</p>"
|
38
|
-
expect(output).to eq "<p>Lorem ipsum\tdolor</p>"
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'replaces newlines with spaces' do
|
42
|
-
output = normalize "<p>Lorem\nipsum\n\ndolor</p>"
|
43
|
-
expect(output).to eq '<p>Lorem ipsum dolor</p>'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'in preformatted node or descendant' do
|
48
|
-
|
49
|
-
it 'does not strip leading and trailing whitespaces' do
|
50
|
-
input = "<pre> Lorem<b> ipsum</b> dolor\n<br> sit amet</pre>"
|
51
|
-
expect(normalize(input)).to eq input
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'does not strip repeated whitespaces' do
|
55
|
-
input = "<pre>Lorem ipsum\t\tdolor\n<code>sit amet</code></pre>"
|
56
|
-
output = normalize input
|
57
|
-
expect(output).to eq input
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'does not replace newlines with spaces' do
|
61
|
-
input = "<pre>Lorem\n<code>\nipsum</code>\n\ndolor</pre>"
|
62
|
-
expect(normalize(input)).to eq input
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def normalize(input)
|
68
|
-
Nokogiri::HTML.fragment(input).normalize!.to_s
|
69
|
-
end
|
70
|
-
end
|
data/spec/io/asciidoc_spec.rb
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
using Corefines::String::unindent
|
2
|
-
|
3
|
-
describe DocTest::IO::Asciidoc do
|
4
|
-
|
5
|
-
it_should_behave_like DocTest::IO::Base
|
6
|
-
|
7
|
-
subject(:suite) { described_class.new(file_ext: '.adoc') }
|
8
|
-
|
9
|
-
|
10
|
-
describe '#initialize' do
|
11
|
-
|
12
|
-
it 'uses ".adoc" as default file_ext' do
|
13
|
-
expect(suite.file_ext).to eq '.adoc'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
describe 'parsing/serialization:' do
|
19
|
-
|
20
|
-
context 'one example' do
|
21
|
-
|
22
|
-
shared_examples :example do
|
23
|
-
let(:parsed) { suite.parse input, 's' }
|
24
|
-
let(:serialized) { suite.serialize output }
|
25
|
-
|
26
|
-
it { expect(parsed).to have(1).items }
|
27
|
-
|
28
|
-
it 'returns an array with parsed example object' do
|
29
|
-
expect(parsed.first).to eql output
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'returns a serialized example as string' do
|
33
|
-
expect(serialized).to eql input
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'with name only' do
|
38
|
-
let(:input) { "// .basic\n" }
|
39
|
-
let(:output) { create_example 's:basic' }
|
40
|
-
|
41
|
-
include_examples :example
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'with multiline content' do
|
45
|
-
let :content do
|
46
|
-
<<-EOF.unindent
|
47
|
-
Paragraphs don't require
|
48
|
-
any special markup.
|
49
|
-
|
50
|
-
To begin a new one, separate it by blank line.
|
51
|
-
EOF
|
52
|
-
end
|
53
|
-
|
54
|
-
let(:input) { "// .multiline\n#{content}" }
|
55
|
-
let(:output) { create_example 's:multiline', content: content.chomp }
|
56
|
-
|
57
|
-
include_examples :example
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'with description' do
|
61
|
-
let :input do
|
62
|
-
<<-EOF.unindent
|
63
|
-
// .strong
|
64
|
-
// This is a description,
|
65
|
-
// see?
|
66
|
-
*allons-y!*
|
67
|
-
EOF
|
68
|
-
end
|
69
|
-
|
70
|
-
let :output do
|
71
|
-
create_example 's:strong', content: '*allons-y!*',
|
72
|
-
desc: "This is a description,\nsee?"
|
73
|
-
end
|
74
|
-
|
75
|
-
include_examples :example
|
76
|
-
end
|
77
|
-
|
78
|
-
context 'with options' do
|
79
|
-
let :input do
|
80
|
-
<<-EOF.unindent
|
81
|
-
// .basic
|
82
|
-
// :exclude: /^=+.*/
|
83
|
-
// :exclude: /^#+.*/
|
84
|
-
// :include: /^----\\n(.*)\\n----/m
|
85
|
-
// :header_footer:
|
86
|
-
_dummy_
|
87
|
-
EOF
|
88
|
-
end
|
89
|
-
|
90
|
-
let :output do
|
91
|
-
create_example 's:basic', content: '_dummy_', opts: {
|
92
|
-
exclude: ['/^=+.*/', '/^#+.*/'],
|
93
|
-
include: ['/^----\\n(.*)\\n----/m'],
|
94
|
-
header_footer: true
|
95
|
-
}
|
96
|
-
end
|
97
|
-
include_examples :example
|
98
|
-
end
|
99
|
-
|
100
|
-
context 'with description and options' do
|
101
|
-
let :input do
|
102
|
-
<<-EOF.unindent
|
103
|
-
// .basic
|
104
|
-
// This is a description.
|
105
|
-
// :exclude: /^=+.*/
|
106
|
-
EOF
|
107
|
-
end
|
108
|
-
|
109
|
-
let :output do
|
110
|
-
create_example 's:basic', desc: 'This is a description.', opts: {
|
111
|
-
exclude: ['/^=+.*/']
|
112
|
-
}
|
113
|
-
end
|
114
|
-
include_examples :example
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
context 'multiple examples' do
|
119
|
-
let :input do
|
120
|
-
<<-EOF.unindent
|
121
|
-
// .basic
|
122
|
-
http://asciidoctor.org
|
123
|
-
|
124
|
-
// .xref
|
125
|
-
Refer to <<section-a>>.
|
126
|
-
EOF
|
127
|
-
end
|
128
|
-
|
129
|
-
subject(:parsed) { suite.parse input, 's' }
|
130
|
-
|
131
|
-
it { is_expected.to have(2).items }
|
132
|
-
|
133
|
-
it 'returns an array with parsed Example objects' do
|
134
|
-
expect(parsed[0]).to eql create_example('s:basic', content: 'http://asciidoctor.org')
|
135
|
-
expect(parsed[1]).to eql create_example('s:xref', content: 'Refer to <<section-a>>.')
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
data/spec/io/xml_spec.rb
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
using Corefines::String::unindent
|
2
|
-
|
3
|
-
describe DocTest::IO::XML do
|
4
|
-
|
5
|
-
it_should_behave_like DocTest::IO::Base
|
6
|
-
|
7
|
-
subject(:suite) { described_class.new(file_ext: '.html') }
|
8
|
-
|
9
|
-
|
10
|
-
describe '#initialize' do
|
11
|
-
|
12
|
-
it 'uses ".html" as default file_ext' do
|
13
|
-
expect(suite.file_ext).to eq '.html'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
describe 'parsing/serialization:' do
|
19
|
-
|
20
|
-
context 'one example' do
|
21
|
-
|
22
|
-
shared_examples :example do
|
23
|
-
let(:parsed) { suite.parse input, 's' }
|
24
|
-
let(:serialized) { suite.serialize output }
|
25
|
-
|
26
|
-
it { (expect parsed).to have(1).items }
|
27
|
-
|
28
|
-
it 'returns an array with parsed example object' do
|
29
|
-
(expect parsed.first).to eql output
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'returns a serialized example as string' do
|
33
|
-
(expect serialized).to eql input
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'with name only' do
|
38
|
-
let(:input) { "<!-- .basic -->\n" }
|
39
|
-
let(:output) { create_example 's:basic' }
|
40
|
-
|
41
|
-
include_examples :example
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'with multiline content' do
|
45
|
-
let :content do
|
46
|
-
<<-EOF.unindent
|
47
|
-
<p>Paragraphs don't require
|
48
|
-
any special markup.</p>
|
49
|
-
|
50
|
-
<p>To begin a new one, separate it by blank line.</p>
|
51
|
-
EOF
|
52
|
-
end
|
53
|
-
|
54
|
-
let(:input) { "<!-- .multiline -->\n#{content}" }
|
55
|
-
let(:output) { create_example 's:multiline', content: content.chomp }
|
56
|
-
|
57
|
-
include_examples :example
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'with description' do
|
61
|
-
let :input do
|
62
|
-
<<-EOF.unindent
|
63
|
-
<!-- .strong
|
64
|
-
This is a description,
|
65
|
-
see?
|
66
|
-
-->
|
67
|
-
<strong>allons-y!</strong>
|
68
|
-
EOF
|
69
|
-
end
|
70
|
-
|
71
|
-
let :output do
|
72
|
-
create_example 's:strong', content: '<strong>allons-y!</strong>',
|
73
|
-
desc: "This is a description,\nsee?"
|
74
|
-
end
|
75
|
-
include_examples :example
|
76
|
-
end
|
77
|
-
|
78
|
-
context 'with options' do
|
79
|
-
let :input do
|
80
|
-
<<-EOF.unindent
|
81
|
-
<!-- .basic
|
82
|
-
:exclude: .//code
|
83
|
-
:exclude: .//section
|
84
|
-
:include: ./p/node()
|
85
|
-
:header_footer:
|
86
|
-
-->
|
87
|
-
<p>dummy</p>
|
88
|
-
EOF
|
89
|
-
end
|
90
|
-
|
91
|
-
let :output do
|
92
|
-
create_example 's:basic', content: '<p>dummy</p>', opts: {
|
93
|
-
exclude: ['.//code', './/section'],
|
94
|
-
include: ['./p/node()'],
|
95
|
-
header_footer: true
|
96
|
-
}
|
97
|
-
end
|
98
|
-
include_examples :example
|
99
|
-
end
|
100
|
-
|
101
|
-
context 'with description and options' do
|
102
|
-
let :input do
|
103
|
-
<<-EOF.unindent
|
104
|
-
<!-- .basic
|
105
|
-
This is a description.
|
106
|
-
:exclude: .//code
|
107
|
-
-->
|
108
|
-
EOF
|
109
|
-
end
|
110
|
-
|
111
|
-
let :output do
|
112
|
-
create_example 's:basic', desc: 'This is a description.', opts: {
|
113
|
-
exclude: ['.//code']
|
114
|
-
}
|
115
|
-
end
|
116
|
-
include_examples :example
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
context 'multiple examples' do
|
121
|
-
let :input do
|
122
|
-
<<-EOF.unindent
|
123
|
-
<!-- .basic -->
|
124
|
-
http://asciidoctor.org
|
125
|
-
|
126
|
-
<!-- .xref -->
|
127
|
-
Refer to <<section-a>>.
|
128
|
-
EOF
|
129
|
-
end
|
130
|
-
|
131
|
-
subject(:parsed) { suite.parse input, 's' }
|
132
|
-
|
133
|
-
it { is_expected.to have(2).items }
|
134
|
-
|
135
|
-
it 'returns an array with parsed Example objects' do
|
136
|
-
expect(parsed[0]).to eql create_example('s:basic', content: 'http://asciidoctor.org')
|
137
|
-
expect(parsed[1]).to eql create_example('s:xref', content: 'Refer to <<section-a>>.')
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|