Skip to content

Commit

Permalink
Merge pull request #46 from dduportal/fix-adoc-diagram
Browse files Browse the repository at this point in the history
Fix #44: Re-Enabling Asciidoctor-diagram usage
  • Loading branch information
dduportal authored Oct 21, 2017
2 parents 34fdbe8 + ea92235 commit 6f28c62
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ RUN apk add --no-cache \
curl \
ca-certificates \
findutils \
graphviz \
make \
openjdk8-jre \
py2-pillow \
python2 \
ruby \
Expand Down
16 changes: 16 additions & 0 deletions tests/fixtures/sample-with-diagram.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

= Sample

This is a sample from
link:https://github.com/asciidoctor/docker-asciidoctor/issues/44#issue-265179207[]

[IMPORTANT]
====
Thanks to link:https://github.com/ryosms[]!
====

[plantuml,sample-diagram,svg]
----
class Sample {
}
----
36 changes: 34 additions & 2 deletions tests/test_suite.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ TMP_GENERATION_DIR="${BATS_TEST_DIRNAME}/tmp"
ASCIIDOCTOR_VERSION="1.5.5"

clean_generated_files() {
rm -rf "${TMP_GENERATION_DIR}"
docker run -t --rm -v "${BATS_TEST_DIRNAME}:${BATS_TEST_DIRNAME}" alpine \
rm -rf "${TMP_GENERATION_DIR}"
}

setup() {
Expand Down Expand Up @@ -42,11 +43,24 @@ teardown() {
docker run -t --rm "${DOCKER_IMAGE_NAME}" which curl
}

@test "bash is installed and in the path" {
docker run -t --rm "${DOCKER_IMAGE_NAME}" which bash
}

@test "java is installed, in the path, and executable" {
docker run -t --rm "${DOCKER_IMAGE_NAME}" which java
docker run -t --rm "${DOCKER_IMAGE_NAME}" java -version
}

@test "dot (from Graphviz) is installed and in the path" {
docker run -t --rm "${DOCKER_IMAGE_NAME}" which dot
}

@test "asciidoctor-confluence is installed and in the path" {
docker run -t --rm "${DOCKER_IMAGE_NAME}" which asciidoctor-confluence
}

@test "We can generate a HTML document from basic example" {
@test "We can generate an HTML document from basic example" {
docker run -t --rm \
-v "${BATS_TEST_DIRNAME}":/documents/ \
"${DOCKER_IMAGE_NAME}" \
Expand All @@ -62,3 +76,21 @@ teardown() {
asciidoctor-pdf -D /documents/tmp -r asciidoctor-mathematical \
/documents/fixtures/basic-example.adoc
}

@test "We can generate an HTML document with a diagram with asciidoctor-diagram as backend" {
run docker run -t --rm \
-v "${BATS_TEST_DIRNAME}":/documents/ \
"${DOCKER_IMAGE_NAME}" \
asciidoctor -D /documents/tmp -r asciidoctor-diagram \
/documents/fixtures/sample-with-diagram.adoc

# Even when in ERROR with the module, asciidoctor return 0 because a document
# has been generated
[ "${status}" -eq 0 ]

echo "-- Output of command:"
echo "${output}"
echo "--"

[ "$(echo ${output} | grep -c -i error)" -eq 0 ]
}

0 comments on commit 6f28c62

Please sign in to comment.