-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathtest_spec.rb
28 lines (23 loc) · 821 Bytes
/
test_spec.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
# frozen_string_literal: true
require "test_helper"
require "json"
class TestSpec < Minitest::Test
spec = load_spec_file("spec.txt")
spec.each do |testcase|
define_method("test_to_html_example_#{testcase[:example]}") do
opts = {
render: {
unsafe_: true,
},
extension: testcase[:extensions].each_with_object({}) do |ext, hash|
hash[ext] = true
end,
}
options = Commonmarker::Config.merged_with_defaults(opts)
options[:extension].delete(:header_ids) # this interefers with the spec.txt extension-less capability
options[:extension][:tasklist] = true
actual = Commonmarker.to_html(testcase[:markdown], options: options, plugins: nil).rstrip
assert_equal testcase[:html], actual, testcase[:markdown]
end
end
end