-
-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy pathhelper.rb
More file actions
35 lines (28 loc) · 899 Bytes
/
helper.rb
File metadata and controls
35 lines (28 loc) · 899 Bytes
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
29
30
31
32
33
34
35
# frozen_string_literal: true
require 'simplecov'
SimpleCov.start
require 'minitest/autorun'
require 'minitest/unit'
require 'mocha/minitest'
require 'shoulda'
require 'open3'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'word-to-markdown'
def fixture_path(fixture = '')
File.expand_path "fixtures/#{fixture}.docx", File.dirname(__FILE__)
end
def validate_fixture(fixture, expected)
path = fixture_path(fixture)
old = WordToMarkdown.new(path).to_s
assert_equal expected, old, "LibreOffice"
new = WordToMarkdown.new(path, nil, true).to_s
assert_equal expected, new, "Pandoc"
end
def stub_doc(html)
doc = WordToMarkdown.new 'test/fixtures/em.docx'
doc.document.stubs(:raw_html).returns(html)
tree = Nokogiri::HTML(doc.document.send(:normalized_html))
doc.document.stubs(:tree).returns(tree)
doc
end