-
Notifications
You must be signed in to change notification settings - Fork 345
Use more standard rspec in cramped include spec #792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
before(:each) do | ||
Asciidoctor::Extensions.register do | ||
preprocessor CrampedInclude | ||
preprocessor ElasticCompatPreprocessor | ||
end | ||
end | ||
|
||
|
@@ -17,60 +16,40 @@ | |
end | ||
|
||
include_examples "doesn't break line numbers" | ||
include_context 'convert without logs' | ||
|
||
it "allows cramped includes of callout lists" do | ||
actual = convert <<~ASCIIDOC | ||
= Test | ||
context 'when including callout lists without a blank line between them' do | ||
let(:input) do | ||
<<~ASCIIDOC | ||
= Test | ||
|
||
== Test | ||
== Test | ||
|
||
include::resources/cramped_include/colist1.adoc[] | ||
include::resources/cramped_include/colist2.adoc[] | ||
ASCIIDOC | ||
expected = <<~DOCBOOK | ||
<chapter id="_test"> | ||
<title>Test</title> | ||
<section id="P1"> | ||
<title>P1</title> | ||
<section id="P1_1"> | ||
<title>P1.1</title> | ||
<programlisting language="java" linenumbering="unnumbered">words <1> <2></programlisting> | ||
<calloutlist> | ||
<callout arearefs="CO1-1"> | ||
<para>foo</para> | ||
</callout> | ||
</calloutlist> | ||
</section> | ||
</section> | ||
<section id="P2"> | ||
<title>P2</title> | ||
<section id="P2_1"> | ||
<title>P2.1</title> | ||
<programlisting language="java" linenumbering="unnumbered">words <1> <2></programlisting> | ||
<calloutlist> | ||
<callout arearefs="CO2-1"> | ||
<para>foo</para> | ||
</callout> | ||
</calloutlist> | ||
</section> | ||
</section> | ||
</chapter> | ||
DOCBOOK | ||
expect(actual).to eq(expected.strip) | ||
include::resources/cramped_include/colist1.adoc[] | ||
include::resources/cramped_include/colist2.adoc[] | ||
ASCIIDOC | ||
end | ||
it 'renders both callout lists' do | ||
expect(converted).to include('<callout arearefs="CO1-1">') | ||
expect(converted).to include('<callout arearefs="CO2-1">') | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason you didn't write it like the following? expect(converted).to include('<callout arearefs="CO1-1">')
expect(converted).to include('<callout arearefs="CO2-1">') There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose the error message is a little more descriptive the way I have it, but not much. Either way is fine by me. If you prefer your way I'll switch it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's pretty minor, so whatever makes most sense to you. |
||
it 'renders the sections that contain the lists' do | ||
expect(converted).to include('<title>P1</title>') | ||
expect(converted).to include('<title>P2</title>') | ||
end | ||
end | ||
|
||
it "doesn't break includes of non-asciidoc files" do | ||
actual = convert <<~ASCIIDOC | ||
---- | ||
include::resources/cramped_include/Example.java[] | ||
---- | ||
ASCIIDOC | ||
expected = <<~DOCBOOK | ||
<preface> | ||
<title></title> | ||
<screen>public class Example {}</screen> | ||
</preface> | ||
DOCBOOK | ||
expect(actual).to eq(expected.strip) | ||
context 'when including non-asciidoc files' do | ||
let(:input) do | ||
<<~ASCIIDOC | ||
---- | ||
include::resources/cramped_include/Example.java[] | ||
---- | ||
ASCIIDOC | ||
end | ||
it "doesn't add an extra newline" do | ||
expect(converted).to include('<screen>public class Example {}</screen>') | ||
# If it did add an extra new line it'd be here --------------^ | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't needed.