-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
/
test_document.rb
48 lines (37 loc) · 1.12 KB
/
test_document.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'helper'
class TestDocument < Test::Unit::TestCase
context "a document in a collection" do
setup do
@site = Site.new(Jekyll.configuration({
"collections" => ["methods"],
"source" => source_dir,
"destination" => dest_dir
}))
@site.process
@document = @site.collections["methods"].docs.first
end
should "know its relative path" do
assert_equal "_methods/configuration.md", @document.relative_path
end
should "knows its extname" do
assert_equal ".md", @document.extname
end
should "know its basename" do
assert_equal "configuration.md", @document.basename
end
should "allow the suffix to be specified for the basename" do
assert_equal "configuration", @document.basename(".*")
end
should "know whether its a yaml file" do
assert_equal false, @document.yaml_file?
end
should "know its data" do
assert_equal({
"title" => "Jekyll.configuration",
"whatever" => "foo.bar"
}, @document.data)
end
end
context " a document part of a rendered collection" do
end
end