Skip to content

Commit

Permalink
Fix usage of TemporaryFolder in tests to avoid AccessDeniedExceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpanzer committed Jan 8, 2022
1 parent 6f4ac24 commit a50573b
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import org.junit.runner.RunWith
import spock.lang.Ignore
import spock.lang.Specification

import static org.asciidoctor.OptionsBuilder.options

@RunWith(ArquillianSputnik)
class WhenExtensionsAreRegisteredAsService extends Specification {

Expand Down Expand Up @@ -51,14 +49,15 @@ class WhenExtensionsAreRegisteredAsService extends Specification {
//To avoid registering the same extension over and over for all tests, service is instantiated manually.
new ArrowsAndBoxesExtension().register(asciidoctor)

Options options = options().inPlace(false)
.toFile(new File(testFolder.getRoot(), FILENAME_HTML))
.safe(SafeMode.UNSAFE).get()
File renderedFile = testFolder.newFile(FILENAME_HTML)
Options options = Options.builder()
.inPlace(false)
.toFile(renderedFile)
.safe(SafeMode.UNSAFE).build()

asciidoctor.convertFile(classpath.getResource('arrows-and-boxes-example.ad'), options)

then:
File renderedFile = new File(testFolder.getRoot(), FILENAME_HTML)
Document doc = Jsoup.parse(renderedFile, 'UTF-8')

Element arrowsJs = doc.select('script[src=http://www.headjump.de/javascripts/arrowsandboxes.js').first()
Expand Down
Loading

0 comments on commit a50573b

Please sign in to comment.