File tree Expand file tree Collapse file tree 2 files changed +52
-6
lines changed
Expand file tree Collapse file tree 2 files changed +52
-6
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,11 @@ def file_name
1010 end
1111
1212 def content
13- <<-CONTENT . gsub /^ \s +/ , ''
14- ---
15- layout: #{ params . layout }
16- title: #{ params . title }
17- ---
18- CONTENT
13+ front_matter = YAML . dump ( {
14+ 'layout' => params . layout ,
15+ 'title' => params . title ,
16+ } )
17+
18+ front_matter + "--- \n "
1919 end
2020end
Original file line number Diff line number Diff line change 1+ RSpec . describe ( Jekyll ::Compose ::FileInfo ) do
2+ describe '#content' do
3+ context 'with a title of only words' do
4+ let ( :expected_result ) { <<-CONTENT . gsub ( /^\s +/ , '' )
5+ ---
6+ layout: post
7+ title: A test arg parser
8+ ---
9+ CONTENT
10+ }
11+
12+ let ( :parsed_args ) { Jekyll ::Compose ::ArgParser . new (
13+ [ 'A test arg parser' ] ,
14+ { }
15+ )
16+ }
17+
18+ it 'does not wrap the title in quotes' do
19+ file_info = described_class . new parsed_args
20+ expect ( file_info . content ) . to eq ( expected_result )
21+ end
22+ end
23+
24+ context 'with a title that includes a colon' do
25+ let ( :expected_result ) { <<-CONTENT . gsub ( /^\s +/ , '' )
26+ ---
27+ layout: post
28+ title: 'A test: arg parser'
29+ ---
30+ CONTENT
31+ }
32+
33+ let ( :parsed_args ) { Jekyll ::Compose ::ArgParser . new (
34+ [ 'A test: arg parser' ] ,
35+ { }
36+ )
37+ }
38+
39+ it 'does wrap the title in quotes' do
40+ file_info = described_class . new parsed_args
41+ expect ( file_info . content ) . to eq ( expected_result )
42+ end
43+ end
44+ end
45+ end
46+
You can’t perform that action at this time.
0 commit comments