sinatra 1.1.0 → 1.1.2

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.

@@ -15,7 +15,7 @@ class NokogiriTest < Test::Unit::TestCase
15
15
  it 'renders inline Nokogiri strings' do
16
16
  nokogiri_app { nokogiri 'xml' }
17
17
  assert ok?
18
- assert_equal %{<?xml version="1.0"?>\n}, body
18
+ assert_body %{<?xml version="1.0"?>\n}
19
19
  end
20
20
 
21
21
  it 'renders inline blocks' do
@@ -26,7 +26,7 @@ class NokogiriTest < Test::Unit::TestCase
26
26
  end
27
27
  end
28
28
  assert ok?
29
- assert_equal "<?xml version=\"1.0\"?>\n<couple>Frank &amp; Mary</couple>\n", body
29
+ assert_body "<?xml version=\"1.0\"?>\n<couple>Frank &amp; Mary</couple>\n"
30
30
  end
31
31
 
32
32
  it 'renders .nokogiri files in views path' do
@@ -35,7 +35,7 @@ class NokogiriTest < Test::Unit::TestCase
35
35
  nokogiri :hello
36
36
  end
37
37
  assert ok?
38
- assert_equal %(<?xml version="1.0"?>\n<exclaim>You're my boy, Blue!</exclaim>\n), body
38
+ assert_body %(<?xml version="1.0"?>\n<exclaim>You're my boy, Blue!</exclaim>\n)
39
39
  end
40
40
 
41
41
  it "renders with inline layouts" do
@@ -46,7 +46,7 @@ class NokogiriTest < Test::Unit::TestCase
46
46
  end
47
47
  get '/'
48
48
  assert ok?
49
- assert_equal "<?xml version=\"1.0\"?>\n<layout>\n <em>Hello World</em>\n</layout>\n", body
49
+ assert_body "<?xml version=\"1.0\"?>\n<layout>\n <em>Hello World</em>\n</layout>\n"
50
50
  end
51
51
 
52
52
  it "renders with file layouts" do
@@ -56,7 +56,7 @@ class NokogiriTest < Test::Unit::TestCase
56
56
  nokogiri %(xml.em 'Hello World'), :layout => :layout2
57
57
  end
58
58
  assert ok?
59
- assert_equal "<?xml version=\"1.0\"?>\n<layout>\n <em>Hello World</em>\n</layout>\n", body
59
+ assert_body "<?xml version=\"1.0\"?>\n<layout>\n <em>Hello World</em>\n</layout>\n"
60
60
  end
61
61
 
62
62
  it "raises error if template not found" do
@@ -15,13 +15,13 @@ class RdocTest < Test::Unit::TestCase
15
15
  it 'renders inline rdoc strings' do
16
16
  rdoc_app { rdoc '= Hiya' }
17
17
  assert ok?
18
- assert_equal "<h1>Hiya</h1>\n", body
18
+ assert_body "<h1>Hiya</h1>"
19
19
  end
20
20
 
21
21
  it 'renders .rdoc files in views path' do
22
22
  rdoc_app { rdoc :hello }
23
23
  assert ok?
24
- assert_equal "<h1>Hello From RDoc</h1>\n", body
24
+ assert_body "<h1>Hello From RDoc</h1>"
25
25
  end
26
26
 
27
27
  it "raises error if template not found" do
@@ -1,3 +1,4 @@
1
+ # I like coding: UTF-8
1
2
  require File.dirname(__FILE__) + '/helper'
2
3
 
3
4
  # Helper method for easy route pattern matching testing
@@ -69,6 +70,14 @@ class RoutingTest < Test::Unit::TestCase
69
70
  assert_equal 'pass', response.headers['X-Cascade']
70
71
  end
71
72
 
73
+ it "allows using unicode" do
74
+ mock_app do
75
+ get('/föö') { }
76
+ end
77
+ get '/f%C3%B6%C3%B6'
78
+ assert_equal 200, status
79
+ end
80
+
72
81
  it "overrides the content-type in error handlers" do
73
82
  mock_app {
74
83
  before { content_type 'text/plain' }
@@ -1,10 +1,10 @@
1
+ # encoding: UTF-8
1
2
  require File.dirname(__FILE__) + '/helper'
2
3
  File.delete(File.dirname(__FILE__) + '/views/layout.test') rescue nil
3
4
 
4
5
  class TestTemplate < Tilt::Template
5
6
  def prepare
6
7
  end
7
- alias compile! prepare # for tilt < 0.7
8
8
 
9
9
  def evaluate(scope, locals={}, &block)
10
10
  inner = block ? block.call : ''
@@ -101,6 +101,15 @@ class TemplatesTest < Test::Unit::TestCase
101
101
  assert_equal "<h1>String Layout!</h1>\n<content><h1>Hello From String</h1></content>", body
102
102
  end
103
103
 
104
+ it 'is possible to use partials in layouts' do
105
+ render_app do
106
+ settings.layout { "<%= erb 'foo' %><%= yield %>" }
107
+ erb 'bar'
108
+ end
109
+ assert ok?
110
+ assert_equal "foobar", body
111
+ end
112
+
104
113
  it 'loads templates from source file' do
105
114
  mock_app { enable :inline_templates }
106
115
  assert_equal "this is foo\n\n", @app.templates[:foo][0]
@@ -128,6 +137,12 @@ class TemplatesTest < Test::Unit::TestCase
128
137
  assert @app.templates.empty?
129
138
  end
130
139
 
140
+ it 'allows unicode in inline templates' do
141
+ mock_app { set :inline_templates, __FILE__ }
142
+ assert_equal "Den som tror at hemma det är där man bor har aldrig vart hos mig.\n\n",
143
+ @app.templates[:umlaut][0]
144
+ end
145
+
131
146
  it 'loads templates from specified views directory' do
132
147
  render_app { render :test, :hello, :views => options.views + '/foo' }
133
148
 
@@ -207,6 +222,9 @@ There's a space after 'bar'!
207
222
  @@ foo bar
208
223
  this is not foo
209
224
 
225
+ @@ umlaut
226
+ Den som tror at hemma det är där man bor har aldrig vart hos mig.
227
+
210
228
  @@ layout
211
229
  X
212
230
  = yield
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 0
10
- version: 1.1.0
9
+ - 2
10
+ version: 1.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Blake Mizerany
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-10-24 00:00:00 +02:00
21
+ date: 2010-12-25 00:00:00 +01:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -44,11 +44,11 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- hash: 13
47
+ hash: 11
48
48
  segments:
49
49
  - 1
50
- - 1
51
- version: "1.1"
50
+ - 2
51
+ version: "1.2"
52
52
  type: :runtime
53
53
  version_requirements: *id002
54
54
  - !ruby/object:Gem::Dependency
@@ -233,8 +233,9 @@ dependencies:
233
233
  - !ruby/object:Gem::Version
234
234
  hash: 3
235
235
  segments:
236
+ - 2
236
237
  - 0
237
- version: "0"
238
+ version: "2.0"
238
239
  type: :development
239
240
  version_requirements: *id015
240
241
  - !ruby/object:Gem::Dependency
@@ -289,7 +290,9 @@ files:
289
290
  - README.fr.rdoc
290
291
  - README.hu.rdoc
291
292
  - README.jp.rdoc
293
+ - README.pt-br.rdoc
292
294
  - README.rdoc
295
+ - README.ru.rdoc
293
296
  - README.zh.rdoc
294
297
  - Rakefile
295
298
  - lib/sinatra.rb