sinatra 1.4.8 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sinatra might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +111 -47
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +41 -49
- data/LICENSE +4 -1
- data/MAINTENANCE.md +42 -0
- data/README.de.md +644 -436
- data/README.es.md +6 -6
- data/README.fr.md +9 -9
- data/README.hu.md +37 -3
- data/README.ja.md +103 -45
- data/README.ko.md +8 -8
- data/README.md +471 -363
- data/README.pt-br.md +3 -3
- data/README.pt-pt.md +2 -2
- data/README.ru.md +42 -64
- data/README.zh.md +8 -8
- data/Rakefile +72 -49
- data/SECURITY.md +35 -0
- data/lib/sinatra/base.rb +137 -195
- data/lib/sinatra/indifferent_hash.rb +150 -0
- data/lib/sinatra/main.rb +1 -0
- data/lib/sinatra/show_exceptions.rb +63 -55
- data/lib/sinatra/version.rb +1 -1
- data/sinatra.gemspec +19 -7
- metadata +30 -164
- data/lib/sinatra/ext.rb +0 -17
- data/test/asciidoctor_test.rb +0 -72
- data/test/base_test.rb +0 -167
- data/test/builder_test.rb +0 -91
- data/test/coffee_test.rb +0 -96
- data/test/compile_test.rb +0 -183
- data/test/contest.rb +0 -91
- data/test/creole_test.rb +0 -65
- data/test/delegator_test.rb +0 -160
- data/test/encoding_test.rb +0 -20
- data/test/erb_test.rb +0 -116
- data/test/extensions_test.rb +0 -98
- data/test/filter_test.rb +0 -487
- data/test/haml_test.rb +0 -109
- data/test/helper.rb +0 -132
- data/test/helpers_test.rb +0 -1917
- data/test/integration/app.rb +0 -79
- data/test/integration_helper.rb +0 -236
- data/test/integration_test.rb +0 -104
- data/test/less_test.rb +0 -69
- data/test/liquid_test.rb +0 -77
- data/test/mapped_error_test.rb +0 -285
- data/test/markaby_test.rb +0 -80
- data/test/markdown_test.rb +0 -85
- data/test/mediawiki_test.rb +0 -68
- data/test/middleware_test.rb +0 -68
- data/test/nokogiri_test.rb +0 -67
- data/test/public/favicon.ico +0 -0
- data/test/public/hello+world.txt +0 -1
- data/test/rabl_test.rb +0 -89
- data/test/rack_test.rb +0 -45
- data/test/radius_test.rb +0 -59
- data/test/rdoc_test.rb +0 -66
- data/test/readme_test.rb +0 -130
- data/test/request_test.rb +0 -100
- data/test/response_test.rb +0 -63
- data/test/result_test.rb +0 -76
- data/test/route_added_hook_test.rb +0 -59
- data/test/routing_test.rb +0 -1456
- data/test/sass_test.rb +0 -115
- data/test/scss_test.rb +0 -88
- data/test/server_test.rb +0 -56
- data/test/settings_test.rb +0 -582
- data/test/sinatra_test.rb +0 -12
- data/test/slim_test.rb +0 -102
- data/test/static_test.rb +0 -266
- data/test/streaming_test.rb +0 -149
- data/test/stylus_test.rb +0 -90
- data/test/templates_test.rb +0 -382
- data/test/textile_test.rb +0 -65
- data/test/views/a/in_a.str +0 -1
- data/test/views/ascii.erb +0 -2
- data/test/views/b/in_b.str +0 -1
- data/test/views/calc.html.erb +0 -1
- data/test/views/error.builder +0 -3
- data/test/views/error.erb +0 -3
- data/test/views/error.haml +0 -3
- data/test/views/error.sass +0 -2
- data/test/views/explicitly_nested.str +0 -1
- data/test/views/foo/hello.test +0 -1
- data/test/views/hello.asciidoc +0 -1
- data/test/views/hello.builder +0 -1
- data/test/views/hello.coffee +0 -1
- data/test/views/hello.creole +0 -1
- data/test/views/hello.erb +0 -1
- data/test/views/hello.haml +0 -1
- data/test/views/hello.less +0 -5
- data/test/views/hello.liquid +0 -1
- data/test/views/hello.mab +0 -1
- data/test/views/hello.md +0 -1
- data/test/views/hello.mediawiki +0 -1
- data/test/views/hello.nokogiri +0 -1
- data/test/views/hello.rabl +0 -2
- data/test/views/hello.radius +0 -1
- data/test/views/hello.rdoc +0 -1
- data/test/views/hello.sass +0 -2
- data/test/views/hello.scss +0 -3
- data/test/views/hello.slim +0 -1
- data/test/views/hello.str +0 -1
- data/test/views/hello.styl +0 -2
- data/test/views/hello.test +0 -1
- data/test/views/hello.textile +0 -1
- data/test/views/hello.wlang +0 -1
- data/test/views/hello.yajl +0 -1
- data/test/views/layout2.builder +0 -3
- data/test/views/layout2.erb +0 -2
- data/test/views/layout2.haml +0 -2
- data/test/views/layout2.liquid +0 -2
- data/test/views/layout2.mab +0 -2
- data/test/views/layout2.nokogiri +0 -3
- data/test/views/layout2.rabl +0 -3
- data/test/views/layout2.radius +0 -2
- data/test/views/layout2.slim +0 -3
- data/test/views/layout2.str +0 -2
- data/test/views/layout2.test +0 -1
- data/test/views/layout2.wlang +0 -2
- data/test/views/nested.str +0 -1
- data/test/views/utf8.erb +0 -2
- data/test/wlang_test.rb +0 -87
- data/test/yajl_test.rb +0 -86
data/test/templates_test.rb
DELETED
@@ -1,382 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require File.expand_path('../helper', __FILE__)
|
3
|
-
File.delete(File.dirname(__FILE__) + '/views/layout.test') rescue nil
|
4
|
-
|
5
|
-
class TestTemplate < Tilt::Template
|
6
|
-
def prepare
|
7
|
-
end
|
8
|
-
|
9
|
-
def evaluate(scope, locals={}, &block)
|
10
|
-
inner = block ? block.call : ''
|
11
|
-
data + inner
|
12
|
-
end
|
13
|
-
|
14
|
-
Tilt.register 'test', self
|
15
|
-
end
|
16
|
-
|
17
|
-
class TemplatesTest < Minitest::Test
|
18
|
-
def render_app(base=Sinatra::Base, options = {}, &block)
|
19
|
-
base, options = Sinatra::Base, base if base.is_a? Hash
|
20
|
-
mock_app(base) do
|
21
|
-
set :views, File.dirname(__FILE__) + '/views'
|
22
|
-
set options
|
23
|
-
get('/', &block)
|
24
|
-
template(:layout3) { "Layout 3!\n" }
|
25
|
-
end
|
26
|
-
get '/'
|
27
|
-
end
|
28
|
-
|
29
|
-
def with_default_layout
|
30
|
-
layout = File.dirname(__FILE__) + '/views/layout.test'
|
31
|
-
File.open(layout, 'wb') { |io| io.write "Layout!\n" }
|
32
|
-
yield
|
33
|
-
ensure
|
34
|
-
File.unlink(layout) rescue nil
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'falls back to engine layout' do
|
38
|
-
mock_app do
|
39
|
-
template(:layout3) { 'Layout 3!<%= yield %>' }
|
40
|
-
set :erb, :layout => :layout3
|
41
|
-
|
42
|
-
get('/') do
|
43
|
-
erb('Hello World!', { :layout => true })
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
get '/'
|
48
|
-
assert ok?
|
49
|
-
assert_equal "Layout 3!Hello World!", body
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'falls back to default layout if engine layout is true' do
|
53
|
-
mock_app do
|
54
|
-
template(:layout) { 'Layout!!! <%= yield %>' }
|
55
|
-
set :erb, :layout => true
|
56
|
-
|
57
|
-
get('/') do
|
58
|
-
erb('Hello World!', { :layout => true })
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
get '/'
|
63
|
-
assert ok?
|
64
|
-
assert_equal "Layout!!! Hello World!", body
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'renders no layout if layout if falsy' do
|
68
|
-
mock_app do
|
69
|
-
template(:layout) { 'Layout!!! <%= yield %>' }
|
70
|
-
set :erb, :layout => true
|
71
|
-
|
72
|
-
get('/') do
|
73
|
-
erb('Hello World!', { :layout => nil })
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
get '/'
|
78
|
-
assert ok?
|
79
|
-
assert_equal "Hello World!", body
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'allows overriding false default layout with explicit true' do
|
83
|
-
mock_app do
|
84
|
-
template(:layout) { 'Layout!!! <%= yield %>' }
|
85
|
-
set :erb, :layout => false
|
86
|
-
|
87
|
-
get('/') do
|
88
|
-
erb('Hello World!', { :layout => true })
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
get '/'
|
93
|
-
assert ok?
|
94
|
-
assert_equal "Layout!!! Hello World!", body
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'renders String templates directly' do
|
98
|
-
render_app { render(:test, 'Hello World') }
|
99
|
-
assert ok?
|
100
|
-
assert_equal 'Hello World', body
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'renders Proc templates using the call result' do
|
104
|
-
render_app { render(:test, Proc.new {'Hello World'}) }
|
105
|
-
assert ok?
|
106
|
-
assert_equal 'Hello World', body
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'looks up Symbol templates in views directory' do
|
110
|
-
render_app { render(:test, :hello) }
|
111
|
-
assert ok?
|
112
|
-
assert_equal "Hello World!\n", body
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'uses the default layout template if not explicitly overridden' do
|
116
|
-
with_default_layout do
|
117
|
-
render_app { render(:test, :hello) }
|
118
|
-
assert ok?
|
119
|
-
assert_equal "Layout!\nHello World!\n", body
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'uses the default layout template if not really overridden' do
|
124
|
-
with_default_layout do
|
125
|
-
render_app { render(:test, :hello, :layout => true) }
|
126
|
-
assert ok?
|
127
|
-
assert_equal "Layout!\nHello World!\n", body
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'uses the layout template specified' do
|
132
|
-
render_app { render(:test, :hello, :layout => :layout2) }
|
133
|
-
assert ok?
|
134
|
-
assert_equal "Layout 2!\nHello World!\n", body
|
135
|
-
end
|
136
|
-
|
137
|
-
it 'uses layout templates defined with the #template method' do
|
138
|
-
render_app { render(:test, :hello, :layout => :layout3) }
|
139
|
-
assert ok?
|
140
|
-
assert_equal "Layout 3!\nHello World!\n", body
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'avoids wrapping layouts around nested templates' do
|
144
|
-
render_app { render(:str, :nested, :layout => :layout2) }
|
145
|
-
assert ok?
|
146
|
-
assert_equal(
|
147
|
-
"<h1>String Layout!</h1>\n<content><h1>Hello From String</h1></content>",
|
148
|
-
body
|
149
|
-
)
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'allows explicitly wrapping layouts around nested templates' do
|
153
|
-
render_app { render(:str, :explicitly_nested, :layout => :layout2) }
|
154
|
-
assert ok?
|
155
|
-
assert_equal(
|
156
|
-
"<h1>String Layout!</h1>\n<content><h1>String Layout!</h1>\n<h1>Hello From String</h1></content>",
|
157
|
-
body
|
158
|
-
)
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'two independent render calls do not disable layouts' do
|
162
|
-
render_app do
|
163
|
-
render :str, :explicitly_nested, :layout => :layout2
|
164
|
-
render :str, :nested, :layout => :layout2
|
165
|
-
end
|
166
|
-
assert ok?
|
167
|
-
assert_equal(
|
168
|
-
"<h1>String Layout!</h1>\n<content><h1>Hello From String</h1></content>",
|
169
|
-
body
|
170
|
-
)
|
171
|
-
end
|
172
|
-
|
173
|
-
it 'is possible to use partials in layouts' do
|
174
|
-
render_app do
|
175
|
-
settings.layout { "<%= erb 'foo' %><%= yield %>" }
|
176
|
-
erb 'bar'
|
177
|
-
end
|
178
|
-
assert ok?
|
179
|
-
assert_equal "foobar", body
|
180
|
-
end
|
181
|
-
|
182
|
-
it 'loads templates from source file' do
|
183
|
-
mock_app { enable(:inline_templates) }
|
184
|
-
assert_equal "this is foo\n\n", @app.templates[:foo][0]
|
185
|
-
assert_equal "X\n= yield\nX\n", @app.templates[:layout][0]
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'ignores spaces after names of inline templates' do
|
189
|
-
mock_app { enable(:inline_templates) }
|
190
|
-
assert_equal "There's a space after 'bar'!\n\n", @app.templates[:bar][0]
|
191
|
-
assert_equal "this is not foo\n\n", @app.templates[:"foo bar"][0]
|
192
|
-
end
|
193
|
-
|
194
|
-
it 'loads templates from given source file' do
|
195
|
-
mock_app { set(:inline_templates, __FILE__) }
|
196
|
-
assert_equal "this is foo\n\n", @app.templates[:foo][0]
|
197
|
-
end
|
198
|
-
|
199
|
-
test 'inline_templates ignores IO errors' do
|
200
|
-
mock_app { set(:inline_templates, '/foo/bar') }
|
201
|
-
|
202
|
-
assert @app.templates.empty?
|
203
|
-
end
|
204
|
-
|
205
|
-
it 'allows unicode in inline templates' do
|
206
|
-
mock_app { set(:inline_templates, __FILE__) }
|
207
|
-
assert_equal(
|
208
|
-
"Den som tror at hemma det är där man bor har aldrig vart hos mig.\n\n",
|
209
|
-
@app.templates[:umlaut][0]
|
210
|
-
)
|
211
|
-
end
|
212
|
-
|
213
|
-
it 'loads templates from specified views directory' do
|
214
|
-
render_app { render(:test, :hello, :views => settings.views + '/foo') }
|
215
|
-
|
216
|
-
assert_equal "from another views directory\n", body
|
217
|
-
end
|
218
|
-
|
219
|
-
it 'takes views directory into consideration for caching' do
|
220
|
-
render_app do
|
221
|
-
render(:test, :hello) + render(:test, :hello, :views => settings.views + '/foo')
|
222
|
-
end
|
223
|
-
assert_equal "Hello World!\nfrom another views directory\n", body
|
224
|
-
end
|
225
|
-
|
226
|
-
it 'passes locals to the layout' do
|
227
|
-
mock_app do
|
228
|
-
template(:my_layout) { 'Hello <%= name %>!<%= yield %>' }
|
229
|
-
|
230
|
-
get('/') do
|
231
|
-
erb('<p>content</p>', { :layout => :my_layout }, { :name => 'Mike'})
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
get '/'
|
236
|
-
assert ok?
|
237
|
-
assert_equal 'Hello Mike!<p>content</p>', body
|
238
|
-
end
|
239
|
-
|
240
|
-
it 'sets layout-only options via layout_options' do
|
241
|
-
render_app do
|
242
|
-
render(:str, :in_a,
|
243
|
-
:views => settings.views + '/a',
|
244
|
-
:layout_options => { :views => settings.views },
|
245
|
-
:layout => :layout2)
|
246
|
-
end
|
247
|
-
|
248
|
-
assert ok?
|
249
|
-
assert_equal "<h1>String Layout!</h1>\nGimme an A!\n", body
|
250
|
-
end
|
251
|
-
|
252
|
-
it 'loads templates defined in subclasses' do
|
253
|
-
base = Class.new(Sinatra::Base)
|
254
|
-
base.template(:foo) { 'bar' }
|
255
|
-
render_app(base) { render(:test, :foo) }
|
256
|
-
assert ok?
|
257
|
-
assert_equal 'bar', body
|
258
|
-
end
|
259
|
-
|
260
|
-
it 'allows setting default content type per template engine' do
|
261
|
-
render_app(:str => { :content_type => :txt }) {
|
262
|
-
render :str, 'foo'
|
263
|
-
}
|
264
|
-
assert_equal 'text/plain;charset=utf-8', response['Content-Type']
|
265
|
-
end
|
266
|
-
|
267
|
-
it 'setting default content type does not affect other template engines' do
|
268
|
-
render_app(:str => { :content_type => :txt }) {
|
269
|
-
render :test, 'foo'
|
270
|
-
}
|
271
|
-
assert_equal 'text/html;charset=utf-8', response['Content-Type']
|
272
|
-
end
|
273
|
-
|
274
|
-
it 'setting default content type per template engine does not override content_type' do
|
275
|
-
render_app :str => { :content_type => :txt } do
|
276
|
-
content_type :html
|
277
|
-
render :str, 'foo'
|
278
|
-
end
|
279
|
-
assert_equal 'text/html;charset=utf-8', response['Content-Type']
|
280
|
-
end
|
281
|
-
|
282
|
-
it 'uses templates in superclasses before subclasses' do
|
283
|
-
base = Class.new(Sinatra::Base)
|
284
|
-
base.template(:foo) { 'template in superclass' }
|
285
|
-
assert_equal 'template in superclass', base.templates[:foo].first.call
|
286
|
-
|
287
|
-
mock_app(base) do
|
288
|
-
set :views, File.dirname(__FILE__) + '/views'
|
289
|
-
template(:foo) { 'template in subclass' }
|
290
|
-
get('/') { render :test, :foo }
|
291
|
-
end
|
292
|
-
assert_equal 'template in subclass', @app.templates[:foo].first.call
|
293
|
-
|
294
|
-
get '/'
|
295
|
-
assert ok?
|
296
|
-
assert_equal 'template in subclass', body
|
297
|
-
end
|
298
|
-
|
299
|
-
it "is possible to use a different engine for the layout than for the template itself explicitly" do
|
300
|
-
render_app do
|
301
|
-
settings.template(:layout) { 'Hello <%= yield %>!' }
|
302
|
-
render :str, "<%= 'World' %>", :layout_engine => :erb
|
303
|
-
end
|
304
|
-
assert_equal "Hello <%= 'World' %>!", body
|
305
|
-
end
|
306
|
-
|
307
|
-
it "is possible to use a different engine for the layout than for the template itself globally" do
|
308
|
-
render_app :str => { :layout_engine => :erb } do
|
309
|
-
settings.template(:layout) { 'Hello <%= yield %>!' }
|
310
|
-
render :str, "<%= 'World' %>"
|
311
|
-
end
|
312
|
-
assert_equal "Hello <%= 'World' %>!", body
|
313
|
-
end
|
314
|
-
|
315
|
-
it "does not leak the content type to the template" do
|
316
|
-
render_app :str => { :layout_engine => :erb } do
|
317
|
-
settings.template(:layout) { 'Hello <%= yield %>!' }
|
318
|
-
render :str, "<%= 'World' %>", :content_type => :txt
|
319
|
-
end
|
320
|
-
assert_equal "text/html;charset=utf-8", headers['Content-Type']
|
321
|
-
end
|
322
|
-
|
323
|
-
it "is possible to register another template" do
|
324
|
-
Tilt.register "html.erb", Tilt[:erb]
|
325
|
-
render_app { render :erb, :calc }
|
326
|
-
assert_equal '2', body
|
327
|
-
end
|
328
|
-
|
329
|
-
it "passes scope to the template" do
|
330
|
-
mock_app do
|
331
|
-
template(:scoped) { 'Hello <%= foo %>' }
|
332
|
-
|
333
|
-
get('/') do
|
334
|
-
some_scope = Object.new
|
335
|
-
def some_scope.foo() 'World!' end
|
336
|
-
erb :scoped, :scope => some_scope
|
337
|
-
end
|
338
|
-
end
|
339
|
-
|
340
|
-
get '/'
|
341
|
-
assert ok?
|
342
|
-
assert_equal 'Hello World!', body
|
343
|
-
end
|
344
|
-
|
345
|
-
it "is possible to use custom logic for finding template files" do
|
346
|
-
mock_app do
|
347
|
-
set :views, ["a", "b"].map { |d| File.dirname(__FILE__) + '/views/' + d }
|
348
|
-
def find_template(views, name, engine, &block)
|
349
|
-
Array(views).each { |v| super(v, name, engine, &block) }
|
350
|
-
end
|
351
|
-
|
352
|
-
get('/:name') { render(:str, params[:name].to_sym) }
|
353
|
-
end
|
354
|
-
|
355
|
-
get '/in_a'
|
356
|
-
assert_body 'Gimme an A!'
|
357
|
-
|
358
|
-
get '/in_b'
|
359
|
-
assert_body 'Gimme a B!'
|
360
|
-
end
|
361
|
-
end
|
362
|
-
|
363
|
-
# __END__ : this is not the real end of the script.
|
364
|
-
|
365
|
-
__END__
|
366
|
-
|
367
|
-
@@ foo
|
368
|
-
this is foo
|
369
|
-
|
370
|
-
@@ bar
|
371
|
-
There's a space after 'bar'!
|
372
|
-
|
373
|
-
@@ foo bar
|
374
|
-
this is not foo
|
375
|
-
|
376
|
-
@@ umlaut
|
377
|
-
Den som tror at hemma det är där man bor har aldrig vart hos mig.
|
378
|
-
|
379
|
-
@@ layout
|
380
|
-
X
|
381
|
-
= yield
|
382
|
-
X
|
data/test/textile_test.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'redcloth'
|
5
|
-
|
6
|
-
class TextileTest < Minitest::Test
|
7
|
-
def textile_app(&block)
|
8
|
-
mock_app do
|
9
|
-
set :views, File.dirname(__FILE__) + '/views'
|
10
|
-
get('/', &block)
|
11
|
-
end
|
12
|
-
get '/'
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'renders inline textile strings' do
|
16
|
-
textile_app { textile('h1. Hiya') }
|
17
|
-
assert ok?
|
18
|
-
assert_equal "<h1>Hiya</h1>", body
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'renders .textile files in views path' do
|
22
|
-
textile_app { textile(:hello) }
|
23
|
-
assert ok?
|
24
|
-
assert_equal "<h1>Hello From Textile</h1>", body
|
25
|
-
end
|
26
|
-
|
27
|
-
it "raises error if template not found" do
|
28
|
-
mock_app { get('/') { textile(:no_such_template) } }
|
29
|
-
assert_raises(Errno::ENOENT) { get('/') }
|
30
|
-
end
|
31
|
-
|
32
|
-
it "renders with inline layouts" do
|
33
|
-
mock_app do
|
34
|
-
layout { 'THIS. IS. #{yield.upcase}!' }
|
35
|
-
get('/') { textile('Sparta', :layout_engine => :str) }
|
36
|
-
end
|
37
|
-
get '/'
|
38
|
-
assert ok?
|
39
|
-
assert_like 'THIS. IS. <P>SPARTA</P>!', body
|
40
|
-
end
|
41
|
-
|
42
|
-
it "renders with file layouts" do
|
43
|
-
textile_app {
|
44
|
-
textile('Hello World', :layout => :layout2, :layout_engine => :erb)
|
45
|
-
}
|
46
|
-
assert ok?
|
47
|
-
assert_body "ERB Layout!\n<p>Hello World</p>"
|
48
|
-
end
|
49
|
-
|
50
|
-
it "can be used in a nested fashion for partials and whatnot" do
|
51
|
-
mock_app do
|
52
|
-
template(:inner) { "hi" }
|
53
|
-
template(:outer) { "<outer><%= textile :inner %></outer>" }
|
54
|
-
get('/') { erb :outer }
|
55
|
-
end
|
56
|
-
|
57
|
-
get '/'
|
58
|
-
assert ok?
|
59
|
-
assert_like '<outer><p>hi</p></outer>', body
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
rescue LoadError
|
64
|
-
warn "#{$!.to_s}: skipping textile tests"
|
65
|
-
end
|
data/test/views/a/in_a.str
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Gimme an A!
|
data/test/views/ascii.erb
DELETED
data/test/views/b/in_b.str
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Gimme a B!
|
data/test/views/calc.html.erb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<%= 1 + 1 %>
|
data/test/views/error.builder
DELETED
data/test/views/error.erb
DELETED
data/test/views/error.haml
DELETED
data/test/views/error.sass
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<content>#{render :str, :hello, :layout => :layout2}</content>
|
data/test/views/foo/hello.test
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
from another views directory
|
data/test/views/hello.asciidoc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
== Hello from AsciiDoc
|
data/test/views/hello.builder
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
xml.exclaim "You're my boy, #{@name}!"
|
data/test/views/hello.coffee
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
alert "Aye!"
|
data/test/views/hello.creole
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
= Hello From Creole
|
data/test/views/hello.erb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Hello <%= 'World' %>
|
data/test/views/hello.haml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
%h1 Hello From Haml
|
data/test/views/hello.less
DELETED
data/test/views/hello.liquid
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Hello From Liquid</h1>
|
data/test/views/hello.mab
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
h1 "Hello From Markaby"
|
data/test/views/hello.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Hello From Markdown
|
data/test/views/hello.mediawiki
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
''Hello from MediaWiki''
|
data/test/views/hello.nokogiri
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
xml.exclaim "You're my boy, #{@name}!"
|
data/test/views/hello.rabl
DELETED
data/test/views/hello.radius
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Hello From Radius</h1>
|
data/test/views/hello.rdoc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
= Hello From RDoc
|
data/test/views/hello.sass
DELETED
data/test/views/hello.scss
DELETED
data/test/views/hello.slim
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
h1 Hello From Slim
|
data/test/views/hello.str
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Hello From String</h1>
|
data/test/views/hello.styl
DELETED
data/test/views/hello.test
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Hello World!
|
data/test/views/hello.textile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
h1. Hello From Textile
|
data/test/views/hello.wlang
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Hello from wlang!
|
data/test/views/hello.yajl
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
json = { :yajl => "hello" }
|
data/test/views/layout2.builder
DELETED
data/test/views/layout2.erb
DELETED
data/test/views/layout2.haml
DELETED
data/test/views/layout2.liquid
DELETED
data/test/views/layout2.mab
DELETED
data/test/views/layout2.nokogiri
DELETED
data/test/views/layout2.rabl
DELETED
data/test/views/layout2.radius
DELETED
data/test/views/layout2.slim
DELETED
data/test/views/layout2.str
DELETED
data/test/views/layout2.test
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Layout 2!
|
data/test/views/layout2.wlang
DELETED
data/test/views/nested.str
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<content>#{render :str, :hello}</content>
|
data/test/views/utf8.erb
DELETED