summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2017-09-22 23:58:59 -0600
committerGitHub <noreply@github.com>2017-09-22 23:58:59 -0600
commit9a50c096621dfecfa0f926cf6b3e5a87f864b48b (patch)
tree16db7b94845a8382fd8d873edcb6aed1b0ac795d /test
parent129024b0d1ce1d4a6ed2087fb687429f017444a4 (diff)
resolves #1394 preserve directories if source dir and destination dir are set (PR #2421)
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/subdir/index.adoc3
-rw-r--r--test/invoker_test.rb18
2 files changed, 21 insertions, 0 deletions
diff --git a/test/fixtures/subdir/index.adoc b/test/fixtures/subdir/index.adoc
new file mode 100644
index 00000000..1bf7957b
--- /dev/null
+++ b/test/fixtures/subdir/index.adoc
@@ -0,0 +1,3 @@
+= Sample Document
+
+content
diff --git a/test/invoker_test.rb b/test/invoker_test.rb
index fd559168..aa7719c9 100644
--- a/test/invoker_test.rb
+++ b/test/invoker_test.rb
@@ -238,6 +238,24 @@ context 'Invoker' do
end
end
+ test 'should preserve directory structure in destination directory if source directory is set' do
+ sample_inpath = 'subdir/index.adoc'
+ destination_path = 'test_output'
+ destination_subdir_path = File.join destination_path, 'subdir'
+ sample_outpath = File.join destination_subdir_path, 'index.html'
+ begin
+ FileUtils.mkdir_p(destination_path)
+ invoker = invoke_cli %W(-D #{destination_path} -R test/fixtures), sample_inpath
+ doc = invoker.document
+ assert File.directory?(destination_subdir_path)
+ assert File.exist?(sample_outpath)
+ ensure
+ FileUtils.rm_f(sample_outpath)
+ FileUtils.rmdir(destination_subdir_path)
+ FileUtils.rmdir(destination_path)
+ end
+ end
+
test 'should output to file specified' do
sample_outpath = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'sample-output.html'))
begin