sinatra 1.4.0.d → 1.4.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.
- data/CHANGES +36 -5
- data/Gemfile +5 -5
- data/README.de.md +982 -706
- data/README.fr.md +2 -2
- data/README.ko.md +12 -6
- data/README.md +52 -55
- data/README.ru.md +21 -21
- data/README.zh.md +128 -125
- data/lib/sinatra/base.rb +25 -11
- data/lib/sinatra/version.rb +1 -1
- data/test/base_test.rb +1 -1
- data/test/contest.rb +3 -1
- data/test/erb_test.rb +1 -1
- data/test/filter_test.rb +51 -1
- data/test/haml_test.rb +1 -1
- data/test/helpers_test.rb +10 -4
- data/test/integration_helper.rb +9 -4
- data/test/integration_test.rb +9 -2
- data/test/request_test.rb +13 -1
- data/test/response_test.rb +1 -2
- data/test/routing_test.rb +123 -0
- data/test/slim_test.rb +1 -1
- data/test/streaming_test.rb +7 -7
- data/test/templates_test.rb +6 -9
- data/test/wlang_test.rb +1 -1
- metadata +9 -6
data/test/slim_test.rb
CHANGED
@@ -78,7 +78,7 @@ class SlimTest < Test::Unit::TestCase
|
|
78
78
|
assert_body '<x foo="bar"></x>'
|
79
79
|
end
|
80
80
|
|
81
|
-
it "can
|
81
|
+
it "can render truly nested layouts by accepting a layout and a block with the contents" do
|
82
82
|
mock_app do
|
83
83
|
template(:main_outer_layout) { "h1 Title\n== yield" }
|
84
84
|
template(:an_inner_layout) { "h2 Subtitle\n== yield" }
|
data/test/streaming_test.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../helper', __FILE__)
|
|
3
3
|
class StreamingTest < Test::Unit::TestCase
|
4
4
|
Stream = Sinatra::Helpers::Stream
|
5
5
|
|
6
|
-
it 'returns the
|
6
|
+
it 'returns the concatenated body' do
|
7
7
|
mock_app do
|
8
8
|
get('/') do
|
9
9
|
stream do |out|
|
@@ -41,18 +41,18 @@ class StreamingTest < Test::Unit::TestCase
|
|
41
41
|
it 'calls the callback after it is done' do
|
42
42
|
step = 0
|
43
43
|
final = 0
|
44
|
-
stream = Stream.new { |
|
44
|
+
stream = Stream.new { |_| 10.times { step += 1 }}
|
45
45
|
stream.callback { final = step }
|
46
|
-
stream.each {
|
46
|
+
stream.each {|_|}
|
47
47
|
assert_equal 10, final
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'does not trigger the callback if close is set to :keep_open' do
|
51
51
|
step = 0
|
52
52
|
final = 0
|
53
|
-
stream = Stream.new(Stream, :keep_open) { |
|
53
|
+
stream = Stream.new(Stream, :keep_open) { |_| 10.times { step += 1 } }
|
54
54
|
stream.callback { final = step }
|
55
|
-
stream.each {
|
55
|
+
stream.each {|_|}
|
56
56
|
assert_equal 0, final
|
57
57
|
end
|
58
58
|
|
@@ -61,7 +61,7 @@ class StreamingTest < Test::Unit::TestCase
|
|
61
61
|
stream = Stream.new { }
|
62
62
|
stream.callback { a = true }
|
63
63
|
stream.callback { b = true }
|
64
|
-
stream.each {
|
64
|
+
stream.each {|_| }
|
65
65
|
assert a, 'should trigger first callback'
|
66
66
|
assert b, 'should trigger second callback'
|
67
67
|
end
|
@@ -110,7 +110,7 @@ class StreamingTest < Test::Unit::TestCase
|
|
110
110
|
|
111
111
|
it 'does not trigger an infinite loop if you call close in a callback' do
|
112
112
|
stream = Stream.new { |out| out.callback { out.close }}
|
113
|
-
stream.each { |
|
113
|
+
stream.each { |_| }
|
114
114
|
end
|
115
115
|
|
116
116
|
it 'gives access to route specific params' do
|
data/test/templates_test.rb
CHANGED
@@ -223,16 +223,13 @@ class TemplatesTest < Test::Unit::TestCase
|
|
223
223
|
end
|
224
224
|
|
225
225
|
it 'sets layout-only options via layout_options' do
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
:layout => :layout2)
|
232
|
-
end
|
226
|
+
render_app do
|
227
|
+
render(:str, :in_a,
|
228
|
+
:views => settings.views + '/a',
|
229
|
+
:layout_options => { :views => settings.views },
|
230
|
+
:layout => :layout2)
|
233
231
|
end
|
234
232
|
|
235
|
-
get '/'
|
236
233
|
assert ok?
|
237
234
|
assert_equal "<h1>String Layout!</h1>\nGimme an A!\n", body
|
238
235
|
end
|
@@ -284,7 +281,7 @@ class TemplatesTest < Test::Unit::TestCase
|
|
284
281
|
assert_equal 'template in subclass', body
|
285
282
|
end
|
286
283
|
|
287
|
-
it "is possible to use a different engine for the layout than for the template itself
|
284
|
+
it "is possible to use a different engine for the layout than for the template itself explicitly" do
|
288
285
|
render_app do
|
289
286
|
settings.template(:layout) { 'Hello <%= yield %>!' }
|
290
287
|
render :str, "<%= 'World' %>", :layout_engine => :erb
|
data/test/wlang_test.rb
CHANGED
@@ -63,7 +63,7 @@ class WLangTest < Test::Unit::TestCase
|
|
63
63
|
assert_body "WLang Layout!\nHello World"
|
64
64
|
end
|
65
65
|
|
66
|
-
it "can
|
66
|
+
it "can rendered truly nested layouts by accepting a layout and a block with the contents" do
|
67
67
|
mock_app do
|
68
68
|
template(:main_outer_layout) { "<h1>Title</h1>\n>{ yield }" }
|
69
69
|
template(:an_inner_layout) { "<h2>Subtitle</h2>\n>{ yield }" }
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.4.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Blake Mizerany
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-03-
|
15
|
+
date: 2013-03-15 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|
@@ -236,13 +236,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
236
|
version: '0'
|
237
237
|
segments:
|
238
238
|
- 0
|
239
|
-
hash: -
|
239
|
+
hash: -99514115148589374
|
240
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
241
|
none: false
|
242
242
|
requirements:
|
243
|
-
- - ! '
|
243
|
+
- - ! '>='
|
244
244
|
- !ruby/object:Gem::Version
|
245
|
-
version:
|
245
|
+
version: '0'
|
246
|
+
segments:
|
247
|
+
- 0
|
248
|
+
hash: -99514115148589374
|
246
249
|
requirements: []
|
247
250
|
rubyforge_project:
|
248
251
|
rubygems_version: 1.8.23
|