sinatra 1.4.8 → 2.0.0.beta1

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.

Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +77 -47
  3. data/CONTRIBUTING.md +1 -1
  4. data/Gemfile +37 -49
  5. data/MAINTENANCE.md +42 -0
  6. data/README.de.md +5 -5
  7. data/README.es.md +5 -5
  8. data/README.fr.md +9 -9
  9. data/README.hu.md +3 -3
  10. data/README.ja.md +19 -8
  11. data/README.ko.md +8 -8
  12. data/README.md +90 -61
  13. data/README.pt-br.md +3 -3
  14. data/README.pt-pt.md +2 -2
  15. data/README.ru.md +42 -26
  16. data/README.zh.md +8 -8
  17. data/Rakefile +0 -6
  18. data/SECURITY.md +35 -0
  19. data/lib/sinatra/base.rb +113 -161
  20. data/lib/sinatra/main.rb +1 -0
  21. data/lib/sinatra/show_exceptions.rb +8 -8
  22. data/lib/sinatra/version.rb +1 -1
  23. data/sinatra.gemspec +7 -4
  24. metadata +34 -168
  25. data/lib/sinatra/ext.rb +0 -17
  26. data/test/asciidoctor_test.rb +0 -72
  27. data/test/base_test.rb +0 -167
  28. data/test/builder_test.rb +0 -91
  29. data/test/coffee_test.rb +0 -96
  30. data/test/compile_test.rb +0 -183
  31. data/test/contest.rb +0 -91
  32. data/test/creole_test.rb +0 -65
  33. data/test/delegator_test.rb +0 -160
  34. data/test/encoding_test.rb +0 -20
  35. data/test/erb_test.rb +0 -116
  36. data/test/extensions_test.rb +0 -98
  37. data/test/filter_test.rb +0 -487
  38. data/test/haml_test.rb +0 -109
  39. data/test/helper.rb +0 -132
  40. data/test/helpers_test.rb +0 -1917
  41. data/test/integration/app.rb +0 -79
  42. data/test/integration_helper.rb +0 -236
  43. data/test/integration_test.rb +0 -104
  44. data/test/less_test.rb +0 -69
  45. data/test/liquid_test.rb +0 -77
  46. data/test/mapped_error_test.rb +0 -285
  47. data/test/markaby_test.rb +0 -80
  48. data/test/markdown_test.rb +0 -85
  49. data/test/mediawiki_test.rb +0 -68
  50. data/test/middleware_test.rb +0 -68
  51. data/test/nokogiri_test.rb +0 -67
  52. data/test/public/favicon.ico +0 -0
  53. data/test/public/hello+world.txt +0 -1
  54. data/test/rabl_test.rb +0 -89
  55. data/test/rack_test.rb +0 -45
  56. data/test/radius_test.rb +0 -59
  57. data/test/rdoc_test.rb +0 -66
  58. data/test/readme_test.rb +0 -130
  59. data/test/request_test.rb +0 -100
  60. data/test/response_test.rb +0 -63
  61. data/test/result_test.rb +0 -76
  62. data/test/route_added_hook_test.rb +0 -59
  63. data/test/routing_test.rb +0 -1456
  64. data/test/sass_test.rb +0 -115
  65. data/test/scss_test.rb +0 -88
  66. data/test/server_test.rb +0 -56
  67. data/test/settings_test.rb +0 -582
  68. data/test/sinatra_test.rb +0 -12
  69. data/test/slim_test.rb +0 -102
  70. data/test/static_test.rb +0 -266
  71. data/test/streaming_test.rb +0 -149
  72. data/test/stylus_test.rb +0 -90
  73. data/test/templates_test.rb +0 -382
  74. data/test/textile_test.rb +0 -65
  75. data/test/views/a/in_a.str +0 -1
  76. data/test/views/ascii.erb +0 -2
  77. data/test/views/b/in_b.str +0 -1
  78. data/test/views/calc.html.erb +0 -1
  79. data/test/views/error.builder +0 -3
  80. data/test/views/error.erb +0 -3
  81. data/test/views/error.haml +0 -3
  82. data/test/views/error.sass +0 -2
  83. data/test/views/explicitly_nested.str +0 -1
  84. data/test/views/foo/hello.test +0 -1
  85. data/test/views/hello.asciidoc +0 -1
  86. data/test/views/hello.builder +0 -1
  87. data/test/views/hello.coffee +0 -1
  88. data/test/views/hello.creole +0 -1
  89. data/test/views/hello.erb +0 -1
  90. data/test/views/hello.haml +0 -1
  91. data/test/views/hello.less +0 -5
  92. data/test/views/hello.liquid +0 -1
  93. data/test/views/hello.mab +0 -1
  94. data/test/views/hello.md +0 -1
  95. data/test/views/hello.mediawiki +0 -1
  96. data/test/views/hello.nokogiri +0 -1
  97. data/test/views/hello.rabl +0 -2
  98. data/test/views/hello.radius +0 -1
  99. data/test/views/hello.rdoc +0 -1
  100. data/test/views/hello.sass +0 -2
  101. data/test/views/hello.scss +0 -3
  102. data/test/views/hello.slim +0 -1
  103. data/test/views/hello.str +0 -1
  104. data/test/views/hello.styl +0 -2
  105. data/test/views/hello.test +0 -1
  106. data/test/views/hello.textile +0 -1
  107. data/test/views/hello.wlang +0 -1
  108. data/test/views/hello.yajl +0 -1
  109. data/test/views/layout2.builder +0 -3
  110. data/test/views/layout2.erb +0 -2
  111. data/test/views/layout2.haml +0 -2
  112. data/test/views/layout2.liquid +0 -2
  113. data/test/views/layout2.mab +0 -2
  114. data/test/views/layout2.nokogiri +0 -3
  115. data/test/views/layout2.rabl +0 -3
  116. data/test/views/layout2.radius +0 -2
  117. data/test/views/layout2.slim +0 -3
  118. data/test/views/layout2.str +0 -2
  119. data/test/views/layout2.test +0 -1
  120. data/test/views/layout2.wlang +0 -2
  121. data/test/views/nested.str +0 -1
  122. data/test/views/utf8.erb +0 -2
  123. data/test/wlang_test.rb +0 -87
  124. data/test/yajl_test.rb +0 -86
@@ -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
@@ -1 +0,0 @@
1
- Gimme an A!
@@ -1,2 +0,0 @@
1
- This file has no unicode in it!
2
- <%= value %>
@@ -1 +0,0 @@
1
- Gimme a B!
@@ -1 +0,0 @@
1
- <%= 1 + 1 %>
@@ -1,3 +0,0 @@
1
- xml.error do
2
- raise "goodbye"
3
- end
@@ -1,3 +0,0 @@
1
- Hello <%= 'World' %>
2
- <% raise 'Goodbye' unless defined?(french) && french %>
3
- <% raise 'Au revoir' if defined?(french) && french %>
@@ -1,3 +0,0 @@
1
- %h1 Hello From Haml
2
- = raise 'goodbye' unless defined?(french) && french
3
- = raise 'au revoir' if defined?(french) && french
@@ -1,2 +0,0 @@
1
- #sass
2
- +argle-bargle
@@ -1 +0,0 @@
1
- <content>#{render :str, :hello, :layout => :layout2}</content>
@@ -1 +0,0 @@
1
- from another views directory
@@ -1 +0,0 @@
1
- == Hello from AsciiDoc
@@ -1 +0,0 @@
1
- xml.exclaim "You're my boy, #{@name}!"
@@ -1 +0,0 @@
1
- alert "Aye!"
@@ -1 +0,0 @@
1
- = Hello From Creole
@@ -1 +0,0 @@
1
- Hello <%= 'World' %>
@@ -1 +0,0 @@
1
- %h1 Hello From Haml
@@ -1,5 +0,0 @@
1
- @white_colour: #fff;
2
-
3
- #main {
4
- background-color: @white_colour;
5
- }
@@ -1 +0,0 @@
1
- <h1>Hello From Liquid</h1>
@@ -1 +0,0 @@
1
- h1 "Hello From Markaby"
@@ -1 +0,0 @@
1
- # Hello From Markdown
@@ -1 +0,0 @@
1
- ''Hello from MediaWiki''
@@ -1 +0,0 @@
1
- xml.exclaim "You're my boy, #{@name}!"
@@ -1,2 +0,0 @@
1
- object @foo
2
- attributes :bar
@@ -1 +0,0 @@
1
- <h1>Hello From Radius</h1>
@@ -1 +0,0 @@
1
- = Hello From RDoc
@@ -1,2 +0,0 @@
1
- #sass
2
- :background-color white
@@ -1,3 +0,0 @@
1
- #scss {
2
- background-color: white
3
- }
@@ -1 +0,0 @@
1
- h1 Hello From Slim
@@ -1 +0,0 @@
1
- <h1>Hello From String</h1>
@@ -1,2 +0,0 @@
1
- a
2
- margin auto
@@ -1 +0,0 @@
1
- Hello World!
@@ -1 +0,0 @@
1
- h1. Hello From Textile
@@ -1 +0,0 @@
1
- Hello from wlang!
@@ -1 +0,0 @@
1
- json = { :yajl => "hello" }
@@ -1,3 +0,0 @@
1
- xml.layout do
2
- xml << yield
3
- end
@@ -1,2 +0,0 @@
1
- ERB Layout!
2
- <%= yield %>
@@ -1,2 +0,0 @@
1
- %h1 HAML Layout!
2
- %p= yield
@@ -1,2 +0,0 @@
1
- <h1>Liquid Layout!</h1>
2
- <p>{{ yield }}</p>
@@ -1,2 +0,0 @@
1
- h1 "Markaby Layout!"
2
- p { yield }
@@ -1,3 +0,0 @@
1
- xml.layout do
2
- xml << yield
3
- end
@@ -1,3 +0,0 @@
1
- node(:qux) do
2
- ::JSON.parse(yield)
3
- end
@@ -1,2 +0,0 @@
1
- <h1>Radius Layout!</h1>
2
- <p><r:yield /></p>
@@ -1,3 +0,0 @@
1
- h1 Slim Layout!
2
- p
3
- == yield
@@ -1,2 +0,0 @@
1
- <h1>String Layout!</h1>
2
- #{yield}
@@ -1 +0,0 @@
1
- Layout 2!
@@ -1,2 +0,0 @@
1
- WLang Layout!
2
- +{yield}
@@ -1 +0,0 @@
1
- <content>#{render :str, :hello}</content>
@@ -1,2 +0,0 @@
1
- <h1><%= value %></h1>
2
- Ingen vill veta var du köpt din tröja.
@@ -1,87 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- begin
4
- require 'wlang'
5
-
6
- class WLangTest < Minitest::Test
7
- def engine
8
- Tilt::WLangTemplate
9
- end
10
-
11
- def wlang_app(&block)
12
- mock_app {
13
- set :views, File.dirname(__FILE__) + '/views'
14
- get '/', &block
15
- }
16
- get '/'
17
- end
18
-
19
- it 'uses the correct engine' do
20
- assert_equal engine, Tilt[:wlang]
21
- end
22
-
23
- it 'renders .wlang files in views path' do
24
- wlang_app { wlang :hello }
25
- assert ok?
26
- assert_equal "Hello from wlang!\n", body
27
- end
28
-
29
- it 'renders in the app instance scope' do
30
- mock_app do
31
- helpers do
32
- def who; "world"; end
33
- end
34
- get('/') { wlang 'Hello +{who}!' }
35
- end
36
- get '/'
37
- assert ok?
38
- assert_equal 'Hello world!', body
39
- end
40
-
41
- it 'takes a :locals option' do
42
- wlang_app do
43
- locals = {:foo => 'Bar'}
44
- wlang 'Hello ${foo}!', :locals => locals
45
- end
46
- assert ok?
47
- assert_equal 'Hello Bar!', body
48
- end
49
-
50
- it "renders with inline layouts" do
51
- mock_app do
52
- layout { 'THIS. IS. +{yield.upcase}!' }
53
- get('/') { wlang 'Sparta' }
54
- end
55
- get '/'
56
- assert ok?
57
- assert_equal 'THIS. IS. SPARTA!', body
58
- end
59
-
60
- it "renders with file layouts" do
61
- wlang_app { wlang 'Hello World', :layout => :layout2 }
62
- assert ok?
63
- assert_body "WLang Layout!\nHello World"
64
- end
65
-
66
- it "can rendered truly nested layouts by accepting a layout and a block with the contents" do
67
- mock_app do
68
- template(:main_outer_layout) { "<h1>Title</h1>\n>{ yield }" }
69
- template(:an_inner_layout) { "<h2>Subtitle</h2>\n>{ yield }" }
70
- template(:a_page) { "<p>Contents.</p>\n" }
71
- get('/') do
72
- wlang :main_outer_layout, :layout => false do
73
- wlang :an_inner_layout do
74
- wlang :a_page
75
- end
76
- end
77
- end
78
- end
79
- get '/'
80
- assert ok?
81
- assert_body "<h1>Title</h1>\n<h2>Subtitle</h2>\n<p>Contents.</p>\n"
82
- end
83
- end
84
-
85
- rescue LoadError
86
- warn "#{$!.to_s}: skipping wlang tests"
87
- end
@@ -1,86 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- begin
4
- require 'yajl'
5
-
6
- class YajlTest < Minitest::Test
7
- def yajl_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 Yajl strings' do
16
- yajl_app { yajl('json = { :foo => "bar" }') }
17
- assert ok?
18
- assert_body '{"foo":"bar"}'
19
- end
20
-
21
- it 'renders .yajl files in views path' do
22
- yajl_app { yajl(:hello) }
23
- assert ok?
24
- assert_body '{"yajl":"hello"}'
25
- end
26
-
27
- it 'raises error if template not found' do
28
- mock_app { get('/') { yajl(:no_such_template) } }
29
- assert_raises(Errno::ENOENT) { get('/') }
30
- end
31
-
32
- it 'accepts a :locals option' do
33
- yajl_app do
34
- locals = { :object => { :foo => 'bar' } }
35
- yajl 'json = object', :locals => locals
36
- end
37
- assert ok?
38
- assert_body '{"foo":"bar"}'
39
- end
40
-
41
- it 'accepts a :scope option' do
42
- yajl_app do
43
- scope = { :object => { :foo => 'bar' } }
44
- yajl 'json = self[:object]', :scope => scope
45
- end
46
- assert ok?
47
- assert_body '{"foo":"bar"}'
48
- end
49
-
50
- it 'decorates the json with a callback' do
51
- yajl_app do
52
- yajl(
53
- 'json = { :foo => "bar" }',
54
- { :callback => 'baz' }
55
- )
56
- end
57
- assert ok?
58
- assert_body 'baz({"foo":"bar"});'
59
- end
60
-
61
- it 'decorates the json with a variable' do
62
- yajl_app do
63
- yajl(
64
- 'json = { :foo => "bar" }',
65
- { :variable => 'qux' }
66
- )
67
- end
68
- assert ok?
69
- assert_body 'var qux = {"foo":"bar"};'
70
- end
71
-
72
- it 'decorates the json with a callback and a variable' do
73
- yajl_app do
74
- yajl(
75
- 'json = { :foo => "bar" }',
76
- { :callback => 'baz', :variable => 'qux' }
77
- )
78
- end
79
- assert ok?
80
- assert_body 'var qux = {"foo":"bar"}; baz(qux);'
81
- end
82
- end
83
-
84
- rescue LoadError
85
- warn "#{$!.to_s}: skipping yajl tests"
86
- end