-
-
Notifications
You must be signed in to change notification settings - Fork 156
/
helper.rb
30 lines (24 loc) · 769 Bytes
/
helper.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
29
30
# 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)
assert_equal expected, WordToMarkdown.new(fixture_path(fixture)).to_s
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