zorglub 0.1.0 → 0.1.2

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/spec/node_spec.rb CHANGED
@@ -1,315 +1,309 @@
1
- # -*- coding: UTF-8 -*-
2
-
3
1
  require 'spec_helper'
4
2
 
5
3
  def clean_static_path
6
- static_base_path = Node0.app.static_base_path
7
- Dir.glob( File.join(static_base_path,'**','*') ).each do |f| File.unlink f if File.file? f end
8
- Dir.glob( File.join(static_base_path,'*') ).each do |d| Dir.rmdir d end
9
- Dir.rmdir static_base_path if File.directory? static_base_path
4
+ static_base_path = Node0.app.static_base_path
5
+ Dir.glob(File.join(static_base_path, '**', '*')).each { |f| File.unlink f if File.file? f }
6
+ Dir.glob(File.join(static_base_path, '*')).each { |d| Dir.rmdir d }
7
+ Dir.rmdir static_base_path if File.directory? static_base_path
10
8
  end
11
9
 
12
10
  describe Zorglub do
11
+ describe Zorglub::Node do
12
+ before(:all) do
13
+ clean_static_path
14
+ end
15
+
16
+ after(:all) do
17
+ clean_static_path
18
+ end
19
+
20
+ it "engine should return default Node's engine" do
21
+ expect(Node0.engine).to eq Node0.app.opt(:engine)
22
+ end
23
+
24
+ it "layout should return default Node's layout" do
25
+ expect(Node0.layout).to eq Node0.app.opt(:layout)
26
+ end
27
+
28
+ it "engine should return class defined Node's engine" do
29
+ expect(Node1.engine).to eq 'engine-1'
30
+ expect(Node3.engine).to eq 'engine-2'
31
+ end
32
+
33
+ it "layout should return class defined Node's layout" do
34
+ expect(Node1.layout).to eq 'layout-1'
35
+ expect(Node3.layout).to eq 'layout-2'
36
+ end
37
+
38
+ it 'engine should return engine inherited from Node2' do
39
+ expect(Node2.engine).to eq 'engine-1'
40
+ end
41
+
42
+ it 'layout should return layout inherited from Node2' do
43
+ expect(Node2.layout).to eq 'layout-1'
44
+ end
45
+
46
+ it 'r should build a well formed path' do
47
+ expect(Node1.r(1, 'arg2', 'some')).to eq '/node1/1/arg2/some'
48
+ end
49
+
50
+ it 'instance level map should work' do
51
+ r = Node0.my_call '/with_2args/1/2'
52
+ h = YAML.load r.body[0]
53
+ expect(h[:map]).to eq '/node0'
54
+ end
55
+
56
+ it 'should return err404 response when no method found' do
57
+ expect(Node0.respond_to?('noresponse')).to be_falsey
58
+ r = Node0.my_call '/noresponse'
59
+ expect(r.status).to eq 404
60
+ end
61
+
62
+ it 'simple method should respond' do
63
+ r = Node0.my_call '/hello'
64
+ expect(r.status).to eq 200
65
+ expect(r.body[0]).to eq 'world'
66
+ end
67
+
68
+ it 'instance level args should work' do
69
+ r = Node0.my_call '/with_2args/1/2'
70
+ h = YAML.load r.body[0]
71
+ expect(h[:args][0]).to eq '1'
72
+ expect(h[:args][1]).to eq '2'
73
+ end
74
+
75
+ it 'should raise error when too much arguments' do
76
+ expect(-> { Node0.my_call '/with_2args/1/2/3' }).to raise_error ArgumentError
77
+ end
78
+
79
+ it 'layout proc, method level layout and engine definitions should work' do
80
+ r = Node0.my_call '/index'
81
+ expect(r.status).to eq 200
82
+ h = YAML.load r.body[0]
83
+ ly = File.join Node0.app.layout_base_path, Node0.layout
84
+ vu = File.join Node0.app.view_base_path, Node0.r, 'index'
85
+ expect(h[:path]).to eq ly
86
+ expect(h[:layout]).to eq ly
87
+ expect(h[:view]).to eq vu
88
+ end
89
+
90
+ it 'layout proc, method level layout and engine definitions should work' do
91
+ r = Node1.my_call '/index'
92
+ expect(r.status).to eq 200
93
+ h = YAML.load r.body[0]
94
+ ly = File.join Node1.app.layout_base_path, 'main.spec'
95
+ vu = File.join Node1.app.view_base_path, Node1.r, 'index.spec'
96
+ expect(h[:path]).to eq ly
97
+ expect(h[:layout]).to eq ly
98
+ expect(h[:view]).to eq vu
99
+ end
100
+
101
+ it 'before_all hook should work' do
102
+ Node3.before = 0
103
+ Node3.after = 0
104
+ expect(Node3.before).to eq 0
105
+ expect(Node3.my_call_i('/index')).to eq 1
106
+ expect(Node3.before).to eq 1
107
+ expect(Node3.my_call_i('/index')).to eq 1
108
+ expect(Node3.before).to eq 2
109
+ expect(Node3.my_call_i('/index')).to eq 1
110
+ expect(Node3.before).to eq 3
111
+ end
112
+
113
+ it 'after_all hook should work' do
114
+ Node3.before = 0
115
+ Node3.after = 0
116
+ expect(Node3.after).to eq 0
117
+ expect(Node3.my_call_i('/index')).to eq 1
118
+ expect(Node3.after).to eq 1
119
+ expect(Node3.my_call_i('/index')).to eq 1
120
+ expect(Node3.after).to eq 2
121
+ expect(Node3.my_call_i('/index')).to eq 1
122
+ expect(Node3.after).to eq 3
123
+ end
124
+
125
+ it 'inherited before_all hook should work' do
126
+ Node3.before = 0
127
+ Node3.after = 0
128
+ expect(Node3.before).to eq 0
129
+ expect(Node8.my_call_i('/index')).to eq 1
130
+ expect(Node3.before).to eq 1
131
+ expect(Node8.my_call_i('/index')).to eq 1
132
+ expect(Node3.before).to eq 2
133
+ expect(Node8.my_call_i('/index')).to eq 1
134
+ expect(Node3.before).to eq 3
135
+ end
136
+
137
+ it 'inherited after_all hook should work' do
138
+ Node3.before = 0
139
+ Node3.after = 0
140
+ expect(Node3.after).to eq 0
141
+ expect(Node8.my_call_i('/index')).to eq 1
142
+ expect(Node3.after).to eq 1
143
+ expect(Node8.my_call_i('/index')).to eq 1
144
+ expect(Node3.after).to eq 2
145
+ expect(Node8.my_call_i('/index')).to eq 1
146
+ expect(Node3.after).to eq 3
147
+ end
148
+
149
+ it 'should find view and layout and render them' do
150
+ r = Node0.my_call '/do_render'
151
+ expect(r.status).to eq 200
152
+ expect(r.body[0]).to eq 'layout_start view_content layout_end'
153
+ end
154
+
155
+ it 'default mime-type should be text/html' do
156
+ r = Node0.my_call '/index'
157
+ expect(r.headers['Content-type']).to eq 'text/html'
158
+ end
159
+
160
+ it 'should be able to override mime-type' do
161
+ r = Node0.my_call '/do_render'
162
+ expect(r.headers['Content-type']).to eq 'text/view'
163
+ end
164
+
165
+ it 'should be able to override through rack response mime-type' do
166
+ r = Node0.my_call '/do_content_type'
167
+ expect(r.headers['Content-type']).to eq 'text/mine'
168
+ end
169
+
170
+ it 'partial should render correctly' do
171
+ expect(Node0.partial({}, :do_partial, 1, 2)).to eq 'partial_content'
172
+ end
173
+
174
+ it 'method level view should work' do
175
+ expect(Node0.partial({}, :other_view)).to eq 'partial_content'
176
+ end
177
+
178
+ it 'partial with hooks should be default' do
179
+ Node3.before = 0
180
+ Node3.after = 0
181
+ expect(Node3.partial({}, :do_partial, 1, 2)).to eq 'partial_content'
182
+ expect(Node3.before).to eq 1
183
+ expect(Node3.after).to eq 1
184
+ end
13
185
 
14
- describe Zorglub::Node do
15
-
16
- before(:all) do
17
- clean_static_path
18
- end
19
-
20
- after(:all) do
21
- clean_static_path
22
- end
23
-
24
- it "engine should return default Node's engine" do
25
- expect(Node0.engine).to eq Node0.app.opt(:engine)
26
- end
27
-
28
- it "layout should return default Node's layout" do
29
- expect(Node0.layout).to eq Node0.app.opt(:layout)
30
- end
31
-
32
- it "engine should return class defined Node's engine" do
33
- expect(Node1.engine).to eq "engine-1"
34
- expect(Node3.engine).to eq "engine-2"
35
- end
36
-
37
- it "layout should return class defined Node's layout" do
38
- expect(Node1.layout).to eq "layout-1"
39
- expect(Node3.layout).to eq "layout-2"
40
- end
41
-
42
- it "engine should return engine inherited from Node2" do
43
- expect(Node2.engine).to eq "engine-1"
44
- end
45
-
46
- it "layout should return layout inherited from Node2" do
47
- expect(Node2.layout).to eq "layout-1"
48
- end
49
-
50
- it "r should build a well formed path" do
51
- expect(Node1.r(1,'arg2',"some")).to eq "/node1/1/arg2/some"
52
- end
53
-
54
- it "instance level map should work" do
55
- r = Node0.my_call '/with_2args/1/2'
56
- h = YAML.load r.body[0]
57
- expect(h[:map]).to eq '/node0'
58
- end
59
-
60
- it "should return err404 response when no method found" do
61
- expect(Node0.respond_to?('noresponse')).to be_falsey
62
- r = Node0.my_call '/noresponse'
63
- expect(r.status).to eq 404
64
- end
65
-
66
- it "simple method should respond" do
67
- r = Node0.my_call '/hello'
68
- expect(r.status).to eq 200
69
- expect(r.body[0]).to eq 'world'
70
- end
71
-
72
- it "instance level args should work" do
73
- r = Node0.my_call '/with_2args/1/2'
74
- h = YAML.load r.body[0]
75
- expect(h[:args][0]).to eq '1'
76
- expect(h[:args][1]).to eq '2'
77
- end
78
-
79
- it "should raise error when too much arguments" do
80
- expect(lambda{ r = Node0.my_call '/with_2args/1/2/3' }).to raise_error ArgumentError
81
- end
82
-
83
- it "layout proc, method level layout and engine definitions should work" do
84
- r = Node0.my_call '/index'
85
- expect(r.status).to eq 200
86
- h = YAML.load r.body[0]
87
- ly = File.join Node0.app.layout_base_path, Node0.layout
88
- vu = File.join Node0.app.view_base_path, Node0.r, 'index'
89
- expect(h[:path]).to eq ly
90
- expect(h[:layout]).to eq ly
91
- expect(h[:view]).to eq vu
92
- end
93
-
94
- it "layout proc, method level layout and engine definitions should work" do
95
- r = Node1.my_call '/index'
96
- expect(r.status).to eq 200
97
- h = YAML.load r.body[0]
98
- ly = File.join Node1.app.layout_base_path, 'main.spec'
99
- vu = File.join Node1.app.view_base_path, Node1.r, 'index.spec'
100
- expect(h[:path]).to eq ly
101
- expect(h[:layout]).to eq ly
102
- expect(h[:view]).to eq vu
103
- end
104
-
105
- it "before_all hook should work" do
106
- Node3.before = 0
107
- Node3.after = 0
108
- expect(Node3.before).to eq 0
109
- expect(Node3.my_call_i('/index')).to eq 1
110
- expect(Node3.before).to eq 1
111
- expect(Node3.my_call_i('/index')).to eq 1
112
- expect(Node3.before).to eq 2
113
- expect(Node3.my_call_i('/index')).to eq 1
114
- expect(Node3.before).to eq 3
115
- end
116
-
117
- it "after_all hook should work" do
118
- Node3.before = 0
119
- Node3.after = 0
120
- expect(Node3.after).to eq 0
121
- expect(Node3.my_call_i('/index')).to eq 1
122
- expect(Node3.after).to eq 1
123
- expect(Node3.my_call_i('/index')).to eq 1
124
- expect(Node3.after).to eq 2
125
- expect(Node3.my_call_i('/index')).to eq 1
126
- expect(Node3.after).to eq 3
127
- end
128
-
129
- it "inherited before_all hook should work" do
130
- Node3.before = 0
131
- Node3.after = 0
132
- expect(Node3.before).to eq 0
133
- expect(Node8.my_call_i('/index')).to eq 1
134
- expect(Node3.before).to eq 1
135
- expect(Node8.my_call_i('/index')).to eq 1
136
- expect(Node3.before).to eq 2
137
- expect(Node8.my_call_i('/index')).to eq 1
138
- expect(Node3.before).to eq 3
139
- end
140
-
141
- it "inherited after_all hook should work" do
142
- Node3.before = 0
143
- Node3.after = 0
144
- expect(Node3.after).to eq 0
145
- expect(Node8.my_call_i('/index')).to eq 1
146
- expect(Node3.after).to eq 1
147
- expect(Node8.my_call_i('/index')).to eq 1
148
- expect(Node3.after).to eq 2
149
- expect(Node8.my_call_i('/index')).to eq 1
150
- expect(Node3.after).to eq 3
151
- end
152
-
153
- it "should find view and layout and render them" do
154
- r = Node0.my_call '/do_render'
155
- expect(r.status).to eq 200
156
- expect(r.body[0]).to eq "layout_start view_content layout_end"
157
- end
158
-
159
- it "default mime-type should be text/html" do
160
- r = Node0.my_call '/index'
161
- expect(r.header['Content-type']).to eq 'text/html'
162
- end
163
-
164
- it "should be able to override mime-type" do
165
- r = Node0.my_call '/do_render'
166
- expect(r.header['Content-type']).to eq 'text/view'
167
- end
168
-
169
- it "should be able to override through rack response mime-type" do
170
- r = Node0.my_call '/do_content_type'
171
- expect(r.header['Content-type']).to eq 'text/mine'
172
- end
173
-
174
- it "partial should render correctly" do
175
- expect(Node0.partial({},:do_partial, 1, 2)).to eq 'partial_content'
176
- end
177
-
178
- it "method level view should work" do
179
- expect(Node0.partial({},:other_view)).to eq 'partial_content'
180
- end
181
-
182
- it "partial with hooks should be default" do
183
- Node3.before = 0
184
- Node3.after = 0
185
- expect(Node3.partial({},:do_partial,1,2)).to eq 'partial_content'
186
- expect(Node3.before).to eq 1
187
- expect(Node3.after).to eq 1
188
- end
189
-
190
- it "partial without hooks should work" do
191
- Node3.before = 0
192
- Node3.after = 0
193
- expect(Node3.partial({:no_hooks=>true},:do_partial,1,2)).to eq 'partial_content'
194
- expect(Node3.before).to eq 0
195
- expect(Node3.after).to eq 0
196
- end
197
-
198
- it "static pages should be generated" do
199
- r = Node6.my_call '/do_static'
200
- expect(r.body[0]).to eq 'VAL 1'
201
- expect(r.header['Content-type']).to eq 'text/static'
202
- r = Node6.my_call '/do_static'
203
- expect(r.body[0]).to eq 'VAL 1'
204
- expect(r.header['Content-type']).to eq 'text/static'
205
- r = Node6.my_call '/do_static'
206
- expect(r.body[0]).to eq 'VAL 1'
207
- expect(r.header['Content-type']).to eq 'text/static'
208
- r = Node6.my_call '/no_static'
209
- expect(r.body[0]).to eq 'VAL 4'
210
- expect(r.header['Content-type']).to eq 'text/static'
211
- r = Node6.my_call '/do_static'
212
- expect(r.body[0]).to eq 'VAL 1'
213
- expect(r.header['Content-type']).to eq 'text/static'
214
- Node6.static! true, 0.000001
215
- sleep 0.0001
216
- r = Node6.my_call '/do_static'
217
- expect(r.body[0]).to eq 'VAL 6'
218
- expect(r.header['Content-type']).to eq 'text/static'
219
- end
220
-
221
- it "redirect should work" do
222
- r = Node0.my_call '/do_redirect'
223
- expect(r.status).to eq 302
224
- expect(r.header['location']).to eq Node0.r(:do_partial,1,2,3)
225
- end
226
-
227
- it "no_layout! should be inherited" do
228
- expect(Node5.layout).to be_nil
229
- end
230
-
231
- it "cli_vals should be inherited and extended" do
232
- r = Node5.my_call '/index'
233
- vars = YAML.load r.body[0]
234
- expect(vars).to eq ['js0','js1','js3','jsx','css0','css1','css2']
235
- expect(vars[7]).to be_nil
236
- end
237
-
238
- it "cli_vals should be extended at method level" do
239
- r = Node4.my_call '/more'
240
- vars = YAML.load r.body[0]
241
- expect(vars).to eq ['js0','js1','js2']
242
- expect(vars[3]).to be_nil
243
- end
244
-
245
- it "cli_vals should be untouched" do
246
- r = Node4.my_call '/index'
247
- vars = YAML.load r.body[0]
248
- expect(vars).to eq ['js0','js1']
249
- expect(vars[2]).to be_nil
250
- r = Node5.my_call '/index'
251
- vars = YAML.load r.body[0]
252
- expect(vars).to eq ['js0','js1','js3','jsx','css0','css1','css2']
253
- expect(vars[7]).to be_nil
254
- end
255
-
256
- it "ext definition and file engine should work" do
257
- r = Node0.my_call '/xml_file'
258
- expect(r.body[0]).to eq "<xml>file<\/xml>\n"
259
- expect(r.header['Content-type']).to eq 'application/xml'
260
- r = Node0.my_call '/plain_file'
261
- expect(r.body[0]).to eq "plain file\n"
262
- expect(r.header['Content-type']).to eq 'text/plain'
263
- end
264
-
265
- it "no view no layout should work as well" do
266
- r = Node0.my_call '/no_view_no_layout'
267
- expect(r.body[0]).to eq "hello world"
268
- end
269
-
270
- it "haml engine should work" do
271
- Node0.app.opt! :engines_cache_enabled, false
272
- r = Node0.my_call '/engines/haml'
273
- expect(r.body[0]).to eq "<h1>Hello world</h1>\n"
274
- Node0.app.opt! :engines_cache_enabled, true
275
- r = Node0.my_call '/engines/haml'
276
- expect(r.body[0]).to eq "<h1>Hello world</h1>\n"
277
- end
278
-
279
- it "sass engine should work" do
280
- Node0.app.opt! :engines_cache_enabled, true
281
- r = Node0.my_call '/engines/sass'
282
- expect(r.body[0]).to eq "vbar{width:80%;height:23px}vbar ul{list-style-type:none}vbar li{float:left}vbar li a{font-weight:bold}\n"
283
- Node0.app.opt! :engines_cache_enabled, false
284
- r = Node0.my_call '/engines/sass'
285
- expect(r.body[0]).to eq "vbar{width:80%;height:23px}vbar ul{list-style-type:none}vbar li{float:left}vbar li a{font-weight:bold}\n"
286
- end
287
-
288
- it "view_base_path! should work" do
289
- r = Node7.my_call '/view_path'
290
- h = YAML.load r.body[0]
291
- expect(h[:view]).to eq File.join(Node7.app.opt(:root), 'alt','do_render')
292
- end
293
-
294
- it "layout_base_path! should work" do
295
- r = Node7.my_call '/view_path'
296
- h = YAML.load r.body[0]
297
- expect(h[:layout]).to eq File.join(Node7.app.opt(:root), 'alt','layout','default')
298
- end
299
-
300
- it "debug out should work" do
301
- stderr0= $stderr.dup
302
- stderrs = StringIO.new
303
- $stderr = stderrs
304
- begin
305
- APP.opt! :debug, true
306
- Node0.my_call '/hello'
307
- ensure
308
- $stderr = stderr0
309
- end
310
- expect(stderrs.string.include?('spec/data/view/node0/hello')).to be true
311
- end
186
+ it 'partial without hooks should work' do
187
+ Node3.before = 0
188
+ Node3.after = 0
189
+ expect(Node3.partial({ no_hooks: true }, :do_partial, 1, 2)).to eq 'partial_content'
190
+ expect(Node3.before).to eq 0
191
+ expect(Node3.after).to eq 0
192
+ end
193
+
194
+ it 'static pages should be generated' do
195
+ r = Node6.my_call '/do_static'
196
+ expect(r.body[0]).to eq 'VAL 1'
197
+ expect(r.headers['Content-type']).to eq 'text/static'
198
+ r = Node6.my_call '/do_static'
199
+ expect(r.body[0]).to eq 'VAL 1'
200
+ expect(r.headers['Content-type']).to eq 'text/static'
201
+ r = Node6.my_call '/do_static'
202
+ expect(r.body[0]).to eq 'VAL 1'
203
+ expect(r.headers['Content-type']).to eq 'text/static'
204
+ r = Node6.my_call '/no_static'
205
+ expect(r.body[0]).to eq 'VAL 4'
206
+ expect(r.headers['Content-type']).to eq 'text/static'
207
+ r = Node6.my_call '/do_static'
208
+ expect(r.body[0]).to eq 'VAL 1'
209
+ expect(r.headers['Content-type']).to eq 'text/static'
210
+ Node6.static! true, 0.000001
211
+ sleep 0.0001
212
+ r = Node6.my_call '/do_static'
213
+ expect(r.body[0]).to eq 'VAL 6'
214
+ expect(r.headers['Content-type']).to eq 'text/static'
215
+ end
216
+
217
+ it 'redirect should work' do
218
+ r = Node0.my_call '/do_redirect'
219
+ expect(r.status).to eq 302
220
+ expect(r.headers['location']).to eq Node0.r(:do_partial, 1, 2, 3)
221
+ end
312
222
 
223
+ it 'no_layout! should be inherited' do
224
+ expect(Node5.layout).to be_nil
313
225
  end
314
226
 
227
+ it 'cli_vals should be inherited and extended' do
228
+ r = Node5.my_call '/index'
229
+ vars = YAML.load r.body[0]
230
+ expect(vars).to eq %w[js0 js1 js3 jsx css0 css1 css2]
231
+ expect(vars[7]).to be_nil
232
+ end
233
+
234
+ it 'cli_vals should be extended at method level' do
235
+ r = Node4.my_call '/more'
236
+ vars = YAML.load r.body[0]
237
+ expect(vars).to eq %w[js0 js1 js2]
238
+ expect(vars[3]).to be_nil
239
+ end
240
+
241
+ it 'cli_vals should be untouched' do
242
+ r = Node4.my_call '/index'
243
+ vars = YAML.load r.body[0]
244
+ expect(vars).to eq %w[js0 js1]
245
+ expect(vars[2]).to be_nil
246
+ r = Node5.my_call '/index'
247
+ vars = YAML.load r.body[0]
248
+ expect(vars).to eq %w[js0 js1 js3 jsx css0 css1 css2]
249
+ expect(vars[7]).to be_nil
250
+ end
251
+
252
+ it 'ext definition and file engine should work' do
253
+ r = Node0.my_call '/xml_file'
254
+ expect(r.body[0]).to eq "<xml>file<\/xml>\n"
255
+ expect(r.headers['Content-type']).to eq 'application/xml'
256
+ r = Node0.my_call '/plain_file'
257
+ expect(r.body[0]).to eq "plain file\n"
258
+ expect(r.headers['Content-type']).to eq 'text/plain'
259
+ end
260
+
261
+ it 'no view no layout should work as well' do
262
+ r = Node0.my_call '/no_view_no_layout'
263
+ expect(r.body[0]).to eq 'hello world'
264
+ end
265
+
266
+ it 'haml engine should work' do
267
+ Node0.app.opt! :engines_cache_enabled, false
268
+ r = Node0.my_call '/engines/haml'
269
+ expect(r.body[0]).to eq "<h1>Hello <i>world</i></h1>\n"
270
+ Node0.app.opt! :engines_cache_enabled, true
271
+ r = Node0.my_call '/engines/haml'
272
+ expect(r.body[0]).to eq "<h1>Hello <i>world</i></h1>\n"
273
+ end
274
+
275
+ it 'sass engine should work' do
276
+ Node0.app.opt! :engines_cache_enabled, true
277
+ r = Node0.my_call '/engines/sass'
278
+ expect(r.body[0]).to eq "vbar{width:80%;height:23px}vbar ul{list-style-type:none}vbar li{float:left}vbar li a{font-weight:bold}\n"
279
+ Node0.app.opt! :engines_cache_enabled, false
280
+ r = Node0.my_call '/engines/sass'
281
+ expect(r.body[0]).to eq "vbar{width:80%;height:23px}vbar ul{list-style-type:none}vbar li{float:left}vbar li a{font-weight:bold}\n"
282
+ end
283
+
284
+ it 'view_base_path! should work' do
285
+ r = Node7.my_call '/view_path'
286
+ h = YAML.load r.body[0]
287
+ expect(h[:view]).to eq File.join(Node7.app.opt(:root), 'alt', 'do_render')
288
+ end
289
+
290
+ it 'layout_base_path! should work' do
291
+ r = Node7.my_call '/view_path'
292
+ h = YAML.load r.body[0]
293
+ expect(h[:layout]).to eq File.join(Node7.app.opt(:root), 'alt', 'layout', 'default')
294
+ end
295
+
296
+ it 'debug out should work' do
297
+ stderr0 = $stderr.dup
298
+ stderrs = StringIO.new
299
+ $stderr = stderrs
300
+ begin
301
+ APP.opt! :debug, true
302
+ Node0.my_call '/hello'
303
+ ensure
304
+ $stderr = stderr0
305
+ end
306
+ expect(stderrs.string.include?('spec/data/view/node0/hello')).to be true
307
+ end
308
+ end
315
309
  end