bonsai 1.3.2 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rvmrc +1 -1
- data/Gemfile +1 -14
- data/Gemfile.lock +33 -21
- data/README.md +4 -4
- data/Rakefile +12 -10
- data/VERSION +1 -1
- data/bonsai.gemspec +69 -113
- data/lib/bonsai/exporter.rb +5 -5
- data/lib/bonsai/page.rb +17 -7
- data/lib/bonsai/templates/public/css/{base.less → base.scss} +2 -0
- data/lib/bonsai/templates/templates/default.liquid +19 -0
- data/lib/bonsai/templates/templates/magic.liquid +28 -0
- data/lib/bonsai/templates/templates/products.liquid +27 -0
- data/lib/bonsai/templates/templates/shared/{analytics.mustache → _analytics.liquid} +0 -0
- data/lib/bonsai/templates/templates/shared/_breadcrumbs.liquid +9 -0
- data/lib/bonsai/templates/templates/shared/{footer.mustache → _footer.liquid} +0 -0
- data/lib/bonsai/templates/templates/shared/{head.mustache → _head.liquid} +0 -0
- data/lib/bonsai/templates/templates/shared/_header.liquid +5 -0
- data/lib/bonsai/templates/templates/shared/_nav.liquid +8 -0
- data/lib/bonsai.rb +4 -2
- data/spec/bonsai/exporter_spec.rb +4 -20
- data/spec/bonsai/generate_spec.rb +3 -3
- data/spec/bonsai/page_spec.rb +171 -187
- data/spec/bonsai/template_spec.rb +1 -1
- data/spec/support/content/{1.about-us/1.contact → render/image-spec}/images/image001.jpg +0 -0
- data/spec/support/content/render/image-spec/images.yml +1 -0
- data/spec/support/public/stylesheets/brokensass.sass +1 -3
- data/spec/support/public/stylesheets/sassy.scss +5 -0
- data/spec/support/templates/children.liquid +4 -0
- data/spec/support/templates/demo-template.liquid +6 -0
- data/spec/support/templates/images.liquid +3 -0
- data/spec/support/templates/partials/{inserted.mustache → _inserted.liquid} +0 -0
- data/spec/support/templates/partials/_magic.liquid +3 -0
- metadata +145 -218
- data/.kick +0 -26
- data/lib/bonsai/templates/templates/default.mustache +0 -17
- data/lib/bonsai/templates/templates/magic.mustache +0 -25
- data/lib/bonsai/templates/templates/products.mustache +0 -25
- data/lib/bonsai/templates/templates/shared/breadcrumbs.mustache +0 -9
- data/lib/bonsai/templates/templates/shared/header.mustache +0 -5
- data/lib/bonsai/templates/templates/shared/nav.mustache +0 -8
- data/spec/support/public/stylesheets/brokenless.less +0 -2
- data/spec/support/public/stylesheets/lesscss.css +0 -1
- data/spec/support/public/stylesheets/lesscss.less +0 -2
- data/spec/support/public/stylesheets/sassy.sass +0 -5
- data/spec/support/templates/demo-template.mustache +0 -19
data/lib/bonsai.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'fileutils'
|
3
3
|
require 'logger'
|
4
|
+
require 'active_support/core_ext/hash/keys'
|
4
5
|
|
5
6
|
$LOAD_PATH << "#{File.dirname(__FILE__)}/bonsai"
|
6
7
|
|
@@ -10,7 +11,7 @@ module Bonsai
|
|
10
11
|
|
11
12
|
def root_dir=(path)
|
12
13
|
unless is_a_bonsai?(path)
|
13
|
-
log "no bonsai site found - are you in the right directory?"
|
14
|
+
log "no bonsai site found - are you in the right directory?"
|
14
15
|
exit 0
|
15
16
|
end
|
16
17
|
|
@@ -19,12 +20,13 @@ module Bonsai
|
|
19
20
|
Exporter.path = "#{path}/output"
|
20
21
|
Page.path = "#{path}/content"
|
21
22
|
Template.path = "#{path}/templates"
|
23
|
+
Liquid::Template.file_system = Liquid::LocalFileSystem.new(Template.path)
|
22
24
|
end
|
23
25
|
|
24
26
|
def log(message)
|
25
27
|
puts message if config[:enable_logging]
|
26
28
|
end
|
27
|
-
|
29
|
+
|
28
30
|
def config
|
29
31
|
@config || { :enable_logging => true }
|
30
32
|
end
|
@@ -16,17 +16,13 @@ describe Bonsai::Exporter do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
shared_examples_for "css generators" do
|
19
|
-
it "should process .
|
20
|
-
File.exists?("#{Bonsai::Exporter.path}/stylesheets/lesscss.css").should be_true
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should process .sass files to .css" do
|
19
|
+
it "should process .scss files to .css" do
|
24
20
|
File.exists?("#{Bonsai::Exporter.path}/stylesheets/sassy.css").should be_true
|
25
21
|
end
|
26
22
|
|
27
23
|
it "should log an error when badly formatted less is supplied (and not raise an exception)" do
|
28
24
|
Bonsai.should_receive(:log)
|
29
|
-
lambda { Bonsai::Exporter.send(:generate_css) }.should_not raise_error(
|
25
|
+
lambda { Bonsai::Exporter.send(:generate_css) }.should_not raise_error(Sass::SyntaxError)
|
30
26
|
end
|
31
27
|
end
|
32
28
|
|
@@ -40,10 +36,6 @@ describe Bonsai::Exporter do
|
|
40
36
|
it_should_behave_like "css generators"
|
41
37
|
|
42
38
|
# Uncompressed CSS
|
43
|
-
it "should be processed with less" do
|
44
|
-
File.read("#{Bonsai::Exporter.path}/stylesheets/lesscss.css").should == ".mymixin, #content { display: block; }\n"
|
45
|
-
end
|
46
|
-
|
47
39
|
it "should be processed with sass" do
|
48
40
|
File.read("#{Bonsai::Exporter.path}/stylesheets/sassy.css").should == "#content {\n display: block; }\n"
|
49
41
|
end
|
@@ -77,18 +69,10 @@ describe Bonsai::Exporter do
|
|
77
69
|
|
78
70
|
it_should_behave_like "css generators"
|
79
71
|
|
80
|
-
# Compressed CSS
|
81
|
-
it "should be processed with less" do
|
82
|
-
File.read("#{Bonsai::Exporter.path}/stylesheets/lesscss.css").should == ".mymixin,#content{display:block;}"
|
83
|
-
end
|
84
|
-
|
72
|
+
# Compressed CSS
|
85
73
|
it "should be processed with sass" do
|
86
74
|
File.read("#{Bonsai::Exporter.path}/stylesheets/sassy.css").should == "#content{display:block;}"
|
87
75
|
end
|
88
|
-
|
89
|
-
it "should not export the base.less file" do
|
90
|
-
File.exists?("#{Bonsai::Exporter.path}/stylesheets/base.less").should be_false
|
91
|
-
end
|
92
76
|
|
93
77
|
it "should create the output directory" do
|
94
78
|
File.exists?(Bonsai::Exporter.path).should be_true
|
@@ -125,7 +109,7 @@ describe Bonsai::Exporter do
|
|
125
109
|
|
126
110
|
describe "asset compression" do
|
127
111
|
it "should compress the css file" do
|
128
|
-
File.read("#{Bonsai::Exporter.path}/stylesheets/
|
112
|
+
File.read("#{Bonsai::Exporter.path}/stylesheets/sassy.css").should == "#content{display:block;}"
|
129
113
|
end
|
130
114
|
|
131
115
|
it "should compress the css file" do
|
@@ -17,8 +17,8 @@ describe Bonsai::Generate do
|
|
17
17
|
File.exists?("#{@path}/public/.htaccess").should be_true
|
18
18
|
end
|
19
19
|
|
20
|
-
it "should copy the base.
|
21
|
-
File.exists?("#{@path}/public/css/base.
|
20
|
+
it "should copy the base.scss file" do
|
21
|
+
File.exists?("#{@path}/public/css/base.scss").should be_true
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should copy an index page" do
|
@@ -26,7 +26,7 @@ describe Bonsai::Generate do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should copy a default template" do
|
29
|
-
File.exists?("#{@path}/templates/default.
|
29
|
+
File.exists?("#{@path}/templates/default.liquid").should be_true
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should create a robots.txt" do
|
data/spec/bonsai/page_spec.rb
CHANGED
@@ -3,247 +3,231 @@
|
|
3
3
|
require "#{File.dirname(__FILE__)}/../spec_helper"
|
4
4
|
|
5
5
|
describe Bonsai::Page do
|
6
|
-
it "should respond to all" do
|
7
|
-
Bonsai::Page.should respond_to :all
|
8
|
-
end
|
9
6
|
|
10
|
-
|
11
|
-
|
7
|
+
describe "class methods" do
|
8
|
+
it "should respond to all" do
|
9
|
+
Bonsai::Page.should respond_to :all
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should contain pages" do
|
13
|
+
Bonsai::Page.all.first.should be_an_instance_of(Bonsai::Page)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should remove numbers over 10 from the permalink" do
|
17
|
+
Bonsai::Page.find("many-pages").permalink.should == "/many-pages/"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should be equal" do
|
21
|
+
Bonsai::Page.find("about-us").should == Bonsai::Page.find("about-us")
|
22
|
+
end
|
12
23
|
end
|
13
24
|
|
14
|
-
describe "
|
25
|
+
describe "relationships" do
|
15
26
|
before :all do
|
16
|
-
@
|
27
|
+
@index = Bonsai::Page.find("index")
|
28
|
+
@about = Bonsai::Page.find("about-us")
|
29
|
+
@history = Bonsai::Page.find("about-us/history")
|
30
|
+
@contact = Bonsai::Page.find("about-us/contact")
|
31
|
+
@child = Bonsai::Page.find("about-us/history/child")
|
17
32
|
end
|
18
33
|
|
19
|
-
it "should have
|
20
|
-
@
|
34
|
+
it "should have siblings" do
|
35
|
+
@history.siblings.should be_an_instance_of(Array)
|
36
|
+
@history.siblings.size.should == 1
|
37
|
+
@history.siblings.should include(@contact)
|
38
|
+
@history.siblings.should_not include(@history)
|
21
39
|
end
|
22
|
-
|
23
|
-
it "should have a
|
24
|
-
@
|
40
|
+
|
41
|
+
it "should have a parent" do
|
42
|
+
@history.parent.should == @about
|
25
43
|
end
|
26
|
-
|
27
|
-
it "should have a
|
28
|
-
@
|
44
|
+
|
45
|
+
it "should not have a parent" do
|
46
|
+
@about.parent.should == nil
|
29
47
|
end
|
30
48
|
|
31
|
-
it "should have a
|
32
|
-
@
|
33
|
-
@page.ctime.should be_an_instance_of(Time)
|
49
|
+
it "should not have a parent for index" do
|
50
|
+
@index.parent.should == nil
|
34
51
|
end
|
35
|
-
|
36
|
-
it "should have
|
37
|
-
@
|
38
|
-
@
|
52
|
+
|
53
|
+
it "should have children" do
|
54
|
+
@about.children.should be_an_instance_of(Array)
|
55
|
+
@about.children.size.should == 1
|
56
|
+
@about.children.should include(@contact)
|
39
57
|
end
|
40
58
|
|
41
|
-
it "should
|
42
|
-
|
59
|
+
it "should not have floating pages in the children array" do
|
60
|
+
@about.children.should_not include(@history)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should have ancestors" do
|
64
|
+
@child.ancestors.should be_an_instance_of(Array)
|
65
|
+
@child.ancestors.size.should == 2
|
66
|
+
@child.ancestors.should include(@history)
|
67
|
+
@child.ancestors.should include(@about)
|
43
68
|
end
|
44
69
|
|
45
|
-
it "should have a
|
46
|
-
@
|
70
|
+
it "should have the ancestors in a top down order" do
|
71
|
+
@child.ancestors.first.should == @about
|
72
|
+
@child.ancestors.last.should == @history
|
47
73
|
end
|
48
74
|
|
49
|
-
it "should
|
50
|
-
@
|
75
|
+
it "index should be a floating page" do
|
76
|
+
@index.floating?.should be_true
|
51
77
|
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
@page.assets.should be_an_instance_of(Array)
|
56
|
-
@page.assets.length.should == 6
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should have the correct name" do
|
60
|
-
@page.assets.first[:name].should == "001"
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should have the correct path" do
|
64
|
-
@page.assets.first[:path].should == "/about-us/history/001.jpg"
|
65
|
-
end
|
66
|
-
|
67
|
-
it "should have the correct disk_path" do
|
68
|
-
@page.assets.first[:disk_path].should == File.join(Dir.pwd, "spec/support/content/1.about-us/history/001.jpg")
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should titleize the name attribute and remove the file extension" do
|
72
|
-
@page.assets[2][:name].should == "A File Asset"
|
73
|
-
end
|
78
|
+
|
79
|
+
it "about should not be a floating page" do
|
80
|
+
@about.floating?.should be_false
|
74
81
|
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe "instance" do
|
85
|
+
let(:page) { Bonsai::Page.find("about-us/history") }
|
86
|
+
subject { page }
|
75
87
|
|
76
|
-
|
77
|
-
|
88
|
+
its(:slug) { should == "history" }
|
89
|
+
its(:name) { should == "History" }
|
90
|
+
its(:permalink) { should == "/about-us/history/" }
|
91
|
+
its(:ctime) { should be_an_instance_of Time }
|
92
|
+
its(:mtime) { should be_an_instance_of Time }
|
93
|
+
its(:write_path) { should == "/about-us/history/index.html" }
|
94
|
+
its(:disk_path) { should == "#{Bonsai.root_dir}/content/1.about-us/history/demo-template.yml" }
|
95
|
+
its(:template) { should be_an_instance_of(Bonsai::Template) }
|
96
|
+
it "should to_hash to its variables" do
|
97
|
+
page.content[:page_title].should == "About our history"
|
98
|
+
page.content[:page_title].should_not be_nil
|
78
99
|
end
|
79
100
|
|
80
|
-
describe "
|
81
|
-
|
82
|
-
@index = Bonsai::Page.find("index")
|
83
|
-
@about = Bonsai::Page.find("about-us")
|
84
|
-
@history = Bonsai::Page.find("about-us/history")
|
85
|
-
@contact = Bonsai::Page.find("about-us/contact")
|
86
|
-
@child = Bonsai::Page.find("about-us/history/child")
|
87
|
-
end
|
101
|
+
describe "assets" do
|
102
|
+
subject { page.assets }
|
88
103
|
|
89
|
-
it
|
90
|
-
|
91
|
-
@history.siblings.size.should == 1
|
92
|
-
@history.siblings.should include(@contact)
|
93
|
-
@history.siblings.should_not include(@history)
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should have a parent" do
|
97
|
-
@history.parent.should == @about
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should not have a parent" do
|
101
|
-
@about.parent.should == nil
|
102
|
-
end
|
104
|
+
it { should be_an_instance_of Array }
|
105
|
+
its(:length) { should be 6 }
|
103
106
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
+
describe "asset properties" do
|
108
|
+
it "should have the correct name" do
|
109
|
+
page.assets.first['name'].should == "001"
|
110
|
+
end
|
107
111
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
@about.children.should include(@contact)
|
112
|
-
end
|
113
|
-
|
114
|
-
it "should not have floating pages in the children array" do
|
115
|
-
@about.children.should_not include(@history)
|
116
|
-
end
|
112
|
+
it "should have the correct path" do
|
113
|
+
page.assets.first['path'].should == "/about-us/history/001.jpg"
|
114
|
+
end
|
117
115
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
@child.ancestors.should include(@history)
|
122
|
-
@child.ancestors.should include(@about)
|
123
|
-
end
|
124
|
-
|
125
|
-
it "should have the ancestors in a top down order" do
|
126
|
-
@child.ancestors.first.should == @about
|
127
|
-
@child.ancestors.last.should == @history
|
128
|
-
end
|
129
|
-
|
130
|
-
it "index should be a floating page" do
|
131
|
-
@index.floating?.should be_true
|
132
|
-
end
|
116
|
+
it "should have the correct disk_path" do
|
117
|
+
page.assets.first['disk_path'].should == File.join(Dir.pwd, "spec/support/content/1.about-us/history/001.jpg")
|
118
|
+
end
|
133
119
|
|
134
|
-
|
135
|
-
|
120
|
+
it "should titleize the name attribute and remove the file extension" do
|
121
|
+
page.assets[2]['name'].should == "A File Asset"
|
122
|
+
end
|
136
123
|
end
|
137
124
|
end
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
@page.content[:page_title].should == "About our history"
|
145
|
-
@page.content[:page_title].should_not be_nil
|
146
|
-
end
|
147
|
-
|
148
|
-
describe "render" do
|
149
|
-
before :all do
|
150
|
-
@output = Bonsai::Page.find("about-us/contact").render
|
151
|
-
end
|
152
|
-
|
153
|
-
it "should render" do
|
154
|
-
@output.should_not be_nil
|
155
|
-
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe "render" do
|
128
|
+
describe "general" do
|
129
|
+
let(:page) { Bonsai::Page.find("about-us/contact").render }
|
130
|
+
subject { page }
|
156
131
|
|
132
|
+
it { should_not be_nil }
|
133
|
+
|
157
134
|
it "should replace mustache variables with properties from the content file" do
|
158
|
-
|
159
|
-
end
|
160
|
-
|
161
|
-
it "should write in images" do
|
162
|
-
@output.should include "image001.jpg"
|
163
|
-
end
|
164
|
-
|
165
|
-
# Pages that use a structure yet have no parent page should still render
|
166
|
-
describe "page without parent" do
|
167
|
-
it "should render successfully" do
|
168
|
-
lambda { Bonsai::Page.find("legals/terms-and-conditions").render }.should_not raise_error
|
169
|
-
end
|
135
|
+
page.should == "Hello from our template, named Contact\n\nGet in touch\n<p>“A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away.”</p>\n\n<p>– Antoine de Saint-Exupery</p>\n\nThis content should be inserted!"
|
170
136
|
end
|
171
137
|
|
172
138
|
describe "markdown" do
|
173
139
|
it "should not use markdown for single line content" do
|
174
|
-
|
140
|
+
page.should =~ /\nGet in touch\n/
|
175
141
|
end
|
176
|
-
|
142
|
+
|
177
143
|
it "should use markdown for multiple line content" do
|
178
|
-
|
144
|
+
page.should =~ /<p>“A designer knows he/
|
179
145
|
end
|
180
|
-
|
146
|
+
|
181
147
|
it "should use smartypants" do
|
182
|
-
|
148
|
+
page.should =~ /“/
|
183
149
|
end
|
184
150
|
end
|
185
151
|
end
|
186
152
|
|
187
|
-
describe "
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
it "should respond to to_hash" do
|
193
|
-
@page.should respond_to(:to_hash)
|
153
|
+
describe "images" do
|
154
|
+
let(:page) { Bonsai::Page.find("render/image-spec").render }
|
155
|
+
it "should render successfully" do
|
156
|
+
page.should == "\n /render/image-spec/images/image001.jpg\n"
|
194
157
|
end
|
195
158
|
|
196
|
-
|
197
|
-
|
198
|
-
@page.to_hash.keys.should include(key.to_sym)
|
199
|
-
end
|
159
|
+
it "should write in images" do
|
160
|
+
page.should include "image001.jpg"
|
200
161
|
end
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
162
|
+
end
|
163
|
+
|
164
|
+
# Pages that use a structure yet have no parent page should still render
|
165
|
+
describe "page without parent" do
|
166
|
+
it "should render successfully" do
|
167
|
+
lambda { Bonsai::Page.find("legals/terms-and-conditions").render }.should_not raise_error
|
206
168
|
end
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
it "it should be a an array of hashes" do
|
223
|
-
@vars[:magic].should be_an_instance_of(Array)
|
224
|
-
@vars[:magic].first.should be_an_instance_of(Hash)
|
225
|
-
@vars[:magic].size.should == 2
|
226
|
-
end
|
227
|
-
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe "to hash" do
|
173
|
+
before :all do
|
174
|
+
@page = Bonsai::Page.find("about-us/history")
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should respond to to_hash" do
|
178
|
+
@page.should respond_to(:to_hash)
|
179
|
+
end
|
180
|
+
|
181
|
+
%w(slug permalink name page_title children siblings parent ancestors magic navigation updated_at created_at).each do |key|
|
182
|
+
it "should have a to_hash key for #{key}" do
|
183
|
+
@page.to_hash.keys.should include(key)
|
228
184
|
end
|
229
185
|
end
|
230
186
|
|
231
|
-
|
187
|
+
it "should include global site variables from site.yml" do
|
188
|
+
@page.to_hash['site_name'].should == "Bonsai"
|
189
|
+
@page.to_hash['url'].should == "http://tinytree.info"
|
190
|
+
@page.to_hash['copyright'].should == 2010
|
191
|
+
end
|
192
|
+
|
193
|
+
describe "disk_assets" do
|
232
194
|
before :all do
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
after :all do
|
237
|
-
Bonsai::Page.path = "spec/support/content"
|
238
|
-
end
|
239
|
-
|
240
|
-
it "should exist" do
|
241
|
-
Bonsai::Page.find("page").should be_an_instance_of(Bonsai::Page)
|
195
|
+
@vars = @page.to_hash
|
242
196
|
end
|
243
197
|
|
244
|
-
|
245
|
-
|
198
|
+
describe "enum" do
|
199
|
+
it "should not have a child" do
|
200
|
+
@vars.should_not have_key('child')
|
201
|
+
end
|
202
|
+
|
203
|
+
it "should have magic" do
|
204
|
+
@vars.should have_key('magic')
|
205
|
+
end
|
206
|
+
|
207
|
+
it "it should be a an array of hashes" do
|
208
|
+
@vars['magic'].should be_an_instance_of(Array)
|
209
|
+
@vars['magic'].first.should be_an_instance_of(Hash)
|
210
|
+
@vars['magic'].size.should == 2
|
211
|
+
end
|
246
212
|
end
|
247
213
|
end
|
248
214
|
end
|
215
|
+
|
216
|
+
describe "broken page" do
|
217
|
+
before :all do
|
218
|
+
Bonsai::Page.path = "spec/support/broken/content"
|
219
|
+
end
|
220
|
+
|
221
|
+
after :all do
|
222
|
+
Bonsai::Page.path = "spec/support/content"
|
223
|
+
end
|
224
|
+
|
225
|
+
it "should exist" do
|
226
|
+
Bonsai::Page.find("page").should be_an_instance_of(Bonsai::Page)
|
227
|
+
end
|
228
|
+
|
229
|
+
it "should error gracefully" do
|
230
|
+
lambda { Bonsai::Page.find("page").render }.should_not raise_error(ArgumentError)
|
231
|
+
end
|
232
|
+
end
|
249
233
|
end
|
@@ -13,7 +13,7 @@ describe Bonsai::Template do
|
|
13
13
|
describe "instance" do
|
14
14
|
it "should give the template source" do
|
15
15
|
@template = Bonsai::Template.find("demo-template")
|
16
|
-
File.read(@template.path).should == "Hello from our template, named {{name}}\n\n{{page_title}}\n
|
16
|
+
File.read(@template.path).should == "Hello from our template, named {{name}}\n\n{{page_title}}\n{{body}}\n\n{% include 'partials/inserted' %}"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
:name: Image rendering
|
File without changes
|