forked from mystand/sablon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
executable_test.rb
28 lines (22 loc) · 941 Bytes
/
executable_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require "test_helper"
class ExecutableTest < Sablon::TestCase
include Sablon::Test::Assertions
def setup
super
@base_path = Pathname.new(File.expand_path("../", __FILE__))
@output_path = @base_path + "sandbox/recipe.docx"
@template_path = @base_path + "fixtures/recipe_template.docx"
@sample_path = @base_path + "fixtures/recipe_sample.docx"
@context_path = @base_path + "fixtures/recipe_context.json"
@executable_path = @base_path + '../exe/sablon'
@output_path.delete if @output_path.exist?
end
def test_generate_document_from_template_output_to_file
`cat #{@context_path} | #{@executable_path} #{@template_path} #{@output_path}`
assert_docx_equal @sample_path, @output_path
end
def test_generate_document_from_template_output_to_stdout
`cat #{@context_path} | #{@executable_path} #{@template_path} > #{@output_path}`
assert_docx_equal @sample_path, @output_path
end
end