forked from asciidoctor/asciidoctorj
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes asciidoctor#405. Adds integration tests to asciidoctorj-distrib…
…ution.
- Loading branch information
1 parent
f87e9cb
commit 527ab90
Showing
3 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...rj-distribution/src/test/groovy/org/asciidoctor/diagram/WhenDitaaDiagramIsRendered.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.asciidoctor.diagram | ||
|
||
import org.asciidoctor.Asciidoctor | ||
import org.asciidoctor.OptionsBuilder | ||
import org.jboss.arquillian.spock.ArquillianSputnik | ||
import org.jboss.arquillian.test.api.ArquillianResource | ||
import org.junit.runner.RunWith | ||
import spock.lang.Specification | ||
|
||
@RunWith(ArquillianSputnik) | ||
class WhenDitaaDiagramIsRendered extends Specification { | ||
|
||
@ArquillianResource | ||
private Asciidoctor asciidoctor | ||
|
||
def 'should render ditaa diagram'() throws Exception { | ||
|
||
given: | ||
|
||
String imageFileName = UUID.randomUUID() | ||
|
||
String document = """= Document Title | ||
Hello World | ||
[ditaa,${imageFileName}] | ||
.... | ||
+---+ | ||
| A | | ||
+---+ | ||
.... | ||
""" | ||
|
||
asciidoctor.requireLibrary('asciidoctor-diagram') | ||
|
||
when: | ||
String result = asciidoctor.convert(document, OptionsBuilder.options().toFile(false).attributes(['imagesoutdir': 'build'])) | ||
|
||
then: | ||
result.contains("""src="${imageFileName}.png""") | ||
new File("build/${imageFileName}.png").exists() | ||
new File("build/${imageFileName}.png.cache").exists() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters