/
publish.feature
73 lines (59 loc) · 2.66 KB
/
publish.feature
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
Feature: Publish document with varying options at the command line
As a writer
I want to create a document at the command line from plain text
So that I can view a typeset version in a web browser
Background:
Given a file named "content.md" with:
"""
Header
======
This is a test. It is theoretically formatted in
the Markdown templating language.
"""
And a file named "style.sass" with:
"""
p
margin: 0
"""
And a file named "layout.haml" with:
"""
%html
%head
%link(rel='stylesheet' href=stylesheet)
%body
#container= content
"""
Scenario: Publish document with defaults
When I run `mint publish content.md`
Then a file named "content.md" should exist
And a file named "content.html" should exist
Scenario Outline: Publish document with named template, layout & style
When I run `mint publish <template> <layout> <style> content.md`
Then a file named "content.html" should exist
And the file "content.html" should contain "This is a test"
And a file named "<style file>" should exist
And the file "content.html" should match /templates.*style.css/
And the file "content.html" should contain "<style file>"
Examples:
| template | layout | style | style file |
| | | | ../../config/templates/default/css/style.css |
| -t zen | | | ../../config/templates/zen/css/style.css |
| | -l zen | -s zen | ../../config/templates/zen/css/style.css |
Scenario: Publish document with non-existent template
When I run `mint publish -t nonexistent content.md`
Then the stderr should contain "Template 'nonexistent' does not exist."
Scenario: Publish document in directory
When I run `mint publish content.md -d compiled`
Then a file named "compiled/content.html" should exist
Scenario: Publish document in subdirectory
When I run `mint publish content.md -d compiled/chapter-1`
Then a file named "compiled/chapter-1/content.html" should exist
Scenario: Publish document with default style and explicit style destination
When I run `mint publish content.md -n styles`
Then a file named "styles/style.css" should exist
Scenario: Publish document with hand-crafted style and explicit style destination
When I run `mint publish content.md -n styles -s style.sass`
Then a file named "styles/style.css" should exist
Scenario: Publish document with hand-crafted layout
When I run `mint publish content.md -l layout.haml`
Then the file "content.html" should match /id=['"]container['"]/