forked from schacon/git-scribe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_test.rb
96 lines (86 loc) · 2.34 KB
/
gen_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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
require File.expand_path "../test_helper", __FILE__
context "scribe gen tests" do
setup do
@scribe = GitScribe.new
end
test "will not respond to non-thing" do
assert_raise RuntimeError do
@scribe.gen('mofo')
end
end
test "scribe can generate single page html" do
in_temp_dir do
@scribe.init('t')
Dir.chdir('t') do
file = @scribe.gen('html')
assert_equal 'book.html', file
out = Dir.glob('output/**/*')
assert out.include? 'output/book.html'
assert out.include? 'output/image'
assert out.include? 'output/stylesheets/handbookish.css'
end
end
end
test "scribe can generate site html" do
in_temp_dir do
@scribe.init('t')
Dir.chdir('t') do
data = @scribe.gen('site')
out = Dir.glob('output/**/*')
assert out.include? 'output/index.html'
assert out.include? 'output/the_first_chapter.html'
assert out.include? 'output/the_second_chapter.html'
assert out.include? 'output/image'
assert out.include? 'output/stylesheets/handbookish.css'
end
end
end
test "scribe can generate a pdf" do
in_temp_dir do
@scribe.init('t')
Dir.chdir('t') do
data = @scribe.gen('pdf')
assert_equal data, 'book.pdf'
out = Dir.glob('output/**/*')
assert out.include? 'output/book.pdf'
end
end
end
test "scribe can generate a epub" do
in_temp_dir do
@scribe.init('t')
Dir.chdir('t') do
data = @scribe.gen('epub')
assert_equal data, 'book.epub'
out = Dir.glob('output/**/*')
assert out.include? 'output/book.epub'
end
end
end
test "scribe can generate a mobi" do
in_temp_dir do
@scribe.init('t')
Dir.chdir('t') do
data = @scribe.gen('mobi')
assert_equal data, 'book.mobi'
out = Dir.glob('output/**/*')
assert out.include? 'output/book.mobi'
end
end
end
test "scribe can generate docbook" do
in_temp_dir do
@scribe.init('t')
Dir.chdir('t') do
data = @scribe.gen('docbook')
assert_equal data, 'book.xml'
out = Dir.glob('output/**/*')
assert out.include? 'output/book.xml'
end
end
end
xtest "scribe can generate all" do
end
xtest "scribe doesn't regen already generated assets" do
end
end