sinatra 0.9.6 → 1.0.a
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 +83 -29
- data/README.jp.rdoc +552 -0
- data/README.rdoc +31 -9
- data/Rakefile +73 -91
- data/lib/sinatra.rb +0 -1
- data/lib/sinatra/base.rb +248 -269
- data/lib/sinatra/main.rb +3 -11
- data/lib/sinatra/tilt.rb +509 -0
- data/sinatra.gemspec +15 -49
- data/test/erubis_test.rb +82 -0
- data/test/extensions_test.rb +1 -1
- data/test/filter_test.rb +125 -3
- data/test/helpers_test.rb +59 -2
- data/test/mapped_error_test.rb +31 -0
- data/test/middleware_test.rb +1 -1
- data/test/request_test.rb +15 -0
- data/test/routing_test.rb +76 -0
- data/test/{options_test.rb → settings_test.rb} +46 -50
- data/test/static_test.rb +13 -0
- data/test/templates_test.rb +43 -10
- data/test/views/error.erubis +3 -0
- data/test/views/hello.erubis +1 -0
- data/test/views/layout2.erubis +2 -0
- metadata +61 -88
- data/compat/app_test.rb +0 -282
- data/compat/application_test.rb +0 -262
- data/compat/builder_test.rb +0 -101
- data/compat/compat_test.rb +0 -12
- data/compat/custom_error_test.rb +0 -62
- data/compat/erb_test.rb +0 -136
- data/compat/events_test.rb +0 -78
- data/compat/filter_test.rb +0 -30
- data/compat/haml_test.rb +0 -237
- data/compat/helper.rb +0 -34
- data/compat/mapped_error_test.rb +0 -72
- data/compat/pipeline_test.rb +0 -45
- data/compat/public/foo.xml +0 -1
- data/compat/sass_test.rb +0 -67
- data/compat/sessions_test.rb +0 -42
- data/compat/streaming_test.rb +0 -133
- data/compat/sym_params_test.rb +0 -18
- data/compat/template_test.rb +0 -30
- data/compat/use_in_file_templates_test.rb +0 -47
- data/compat/views/foo.builder +0 -1
- data/compat/views/foo.erb +0 -1
- data/compat/views/foo.haml +0 -1
- data/compat/views/foo.sass +0 -2
- data/compat/views/foo_layout.erb +0 -2
- data/compat/views/foo_layout.haml +0 -2
- data/compat/views/layout_test/foo.builder +0 -1
- data/compat/views/layout_test/foo.erb +0 -1
- data/compat/views/layout_test/foo.haml +0 -1
- data/compat/views/layout_test/foo.sass +0 -2
- data/compat/views/layout_test/layout.builder +0 -3
- data/compat/views/layout_test/layout.erb +0 -1
- data/compat/views/layout_test/layout.haml +0 -1
- data/compat/views/layout_test/layout.sass +0 -2
- data/compat/views/no_layout/no_layout.builder +0 -1
- data/compat/views/no_layout/no_layout.haml +0 -1
- data/lib/sinatra/compat.rb +0 -258
- data/lib/sinatra/test.rb +0 -129
- data/lib/sinatra/test/bacon.rb +0 -19
- data/lib/sinatra/test/rspec.rb +0 -13
- data/lib/sinatra/test/spec.rb +0 -11
- data/lib/sinatra/test/unit.rb +0 -13
- data/test/render_backtrace_test.rb +0 -145
- data/test/test_test.rb +0 -155
@@ -0,0 +1 @@
|
|
1
|
+
Hello <%= 'World' %>
|
metadata
CHANGED
@@ -1,69 +1,82 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
- 6
|
9
|
-
version: 0.9.6
|
4
|
+
version: 1.0.a
|
10
5
|
platform: ruby
|
11
6
|
authors:
|
12
7
|
- Blake Mizerany
|
8
|
+
- Ryan Tomayko
|
9
|
+
- Simon Rozet
|
13
10
|
autorequire:
|
14
11
|
bindir: bin
|
15
12
|
cert_chain: []
|
16
13
|
|
17
|
-
date: 2010-
|
14
|
+
date: 2010-01-28 00:00:00 -08:00
|
18
15
|
default_executable:
|
19
16
|
dependencies:
|
20
17
|
- !ruby/object:Gem::Dependency
|
21
18
|
name: rack
|
22
|
-
|
23
|
-
|
19
|
+
type: :runtime
|
20
|
+
version_requirement:
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
22
|
requirements:
|
25
23
|
- - ">="
|
26
24
|
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
|
29
|
-
- 9
|
30
|
-
- 1
|
31
|
-
version: 0.9.1
|
32
|
-
type: :runtime
|
33
|
-
version_requirements: *id001
|
25
|
+
version: "1.0"
|
26
|
+
version:
|
34
27
|
- !ruby/object:Gem::Dependency
|
35
28
|
name: shotgun
|
36
|
-
|
37
|
-
|
29
|
+
type: :development
|
30
|
+
version_requirement:
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
32
|
requirements:
|
39
33
|
- - ">="
|
40
34
|
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
- 0
|
43
|
-
- 2
|
44
|
-
version: "0.2"
|
35
|
+
version: "0.6"
|
45
36
|
- - <
|
46
37
|
- !ruby/object:Gem::Version
|
47
|
-
segments:
|
48
|
-
- 1
|
49
|
-
- 0
|
50
38
|
version: "1.0"
|
51
|
-
|
52
|
-
version_requirements: *id002
|
39
|
+
version:
|
53
40
|
- !ruby/object:Gem::Dependency
|
54
41
|
name: rack-test
|
55
|
-
|
56
|
-
|
42
|
+
type: :development
|
43
|
+
version_requirement:
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
45
|
requirements:
|
58
46
|
- - ">="
|
59
47
|
- !ruby/object:Gem::Version
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
- 3
|
63
|
-
- 0
|
64
48
|
version: 0.3.0
|
49
|
+
version:
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: haml
|
52
|
+
type: :development
|
53
|
+
version_requirement:
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: "0"
|
59
|
+
version:
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: builder
|
62
|
+
type: :development
|
63
|
+
version_requirement:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: erubis
|
65
72
|
type: :development
|
66
|
-
|
73
|
+
version_requirement:
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
version:
|
67
80
|
description: Classy web-development dressed in a DSL
|
68
81
|
email: sinatrarb@googlegroups.com
|
69
82
|
executables: []
|
@@ -77,60 +90,22 @@ files:
|
|
77
90
|
- AUTHORS
|
78
91
|
- CHANGES
|
79
92
|
- LICENSE
|
93
|
+
- README.jp.rdoc
|
80
94
|
- README.rdoc
|
81
95
|
- Rakefile
|
82
|
-
- compat/app_test.rb
|
83
|
-
- compat/application_test.rb
|
84
|
-
- compat/builder_test.rb
|
85
|
-
- compat/compat_test.rb
|
86
|
-
- compat/custom_error_test.rb
|
87
|
-
- compat/erb_test.rb
|
88
|
-
- compat/events_test.rb
|
89
|
-
- compat/filter_test.rb
|
90
|
-
- compat/haml_test.rb
|
91
|
-
- compat/helper.rb
|
92
|
-
- compat/mapped_error_test.rb
|
93
|
-
- compat/pipeline_test.rb
|
94
|
-
- compat/public/foo.xml
|
95
|
-
- compat/sass_test.rb
|
96
|
-
- compat/sessions_test.rb
|
97
|
-
- compat/streaming_test.rb
|
98
|
-
- compat/sym_params_test.rb
|
99
|
-
- compat/template_test.rb
|
100
|
-
- compat/use_in_file_templates_test.rb
|
101
|
-
- compat/views/foo.builder
|
102
|
-
- compat/views/foo.erb
|
103
|
-
- compat/views/foo.haml
|
104
|
-
- compat/views/foo.sass
|
105
|
-
- compat/views/foo_layout.erb
|
106
|
-
- compat/views/foo_layout.haml
|
107
|
-
- compat/views/layout_test/foo.builder
|
108
|
-
- compat/views/layout_test/foo.erb
|
109
|
-
- compat/views/layout_test/foo.haml
|
110
|
-
- compat/views/layout_test/foo.sass
|
111
|
-
- compat/views/layout_test/layout.builder
|
112
|
-
- compat/views/layout_test/layout.erb
|
113
|
-
- compat/views/layout_test/layout.haml
|
114
|
-
- compat/views/layout_test/layout.sass
|
115
|
-
- compat/views/no_layout/no_layout.builder
|
116
|
-
- compat/views/no_layout/no_layout.haml
|
117
96
|
- lib/sinatra.rb
|
118
97
|
- lib/sinatra/base.rb
|
119
|
-
- lib/sinatra/compat.rb
|
120
98
|
- lib/sinatra/images/404.png
|
121
99
|
- lib/sinatra/images/500.png
|
122
100
|
- lib/sinatra/main.rb
|
123
101
|
- lib/sinatra/showexceptions.rb
|
124
|
-
- lib/sinatra/
|
125
|
-
- lib/sinatra/test/bacon.rb
|
126
|
-
- lib/sinatra/test/rspec.rb
|
127
|
-
- lib/sinatra/test/spec.rb
|
128
|
-
- lib/sinatra/test/unit.rb
|
102
|
+
- lib/sinatra/tilt.rb
|
129
103
|
- sinatra.gemspec
|
130
104
|
- test/base_test.rb
|
131
105
|
- test/builder_test.rb
|
132
106
|
- test/contest.rb
|
133
107
|
- test/erb_test.rb
|
108
|
+
- test/erubis_test.rb
|
134
109
|
- test/extensions_test.rb
|
135
110
|
- test/filter_test.rb
|
136
111
|
- test/haml_test.rb
|
@@ -138,9 +113,7 @@ files:
|
|
138
113
|
- test/helpers_test.rb
|
139
114
|
- test/mapped_error_test.rb
|
140
115
|
- test/middleware_test.rb
|
141
|
-
- test/options_test.rb
|
142
116
|
- test/public/favicon.ico
|
143
|
-
- test/render_backtrace_test.rb
|
144
117
|
- test/request_test.rb
|
145
118
|
- test/response_test.rb
|
146
119
|
- test/result_test.rb
|
@@ -148,22 +121,25 @@ files:
|
|
148
121
|
- test/routing_test.rb
|
149
122
|
- test/sass_test.rb
|
150
123
|
- test/server_test.rb
|
124
|
+
- test/settings_test.rb
|
151
125
|
- test/sinatra_test.rb
|
152
126
|
- test/static_test.rb
|
153
127
|
- test/templates_test.rb
|
154
|
-
- test/test_test.rb
|
155
128
|
- test/views/error.builder
|
156
129
|
- test/views/error.erb
|
130
|
+
- test/views/error.erubis
|
157
131
|
- test/views/error.haml
|
158
132
|
- test/views/error.sass
|
159
133
|
- test/views/foo/hello.test
|
160
134
|
- test/views/hello.builder
|
161
135
|
- test/views/hello.erb
|
136
|
+
- test/views/hello.erubis
|
162
137
|
- test/views/hello.haml
|
163
138
|
- test/views/hello.sass
|
164
139
|
- test/views/hello.test
|
165
140
|
- test/views/layout2.builder
|
166
141
|
- test/views/layout2.erb
|
142
|
+
- test/views/layout2.erubis
|
167
143
|
- test/views/layout2.haml
|
168
144
|
- test/views/layout2.test
|
169
145
|
has_rdoc: true
|
@@ -184,20 +160,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
160
|
requirements:
|
185
161
|
- - ">="
|
186
162
|
- !ruby/object:Gem::Version
|
187
|
-
segments:
|
188
|
-
- 0
|
189
163
|
version: "0"
|
164
|
+
version:
|
190
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
166
|
requirements:
|
192
|
-
- - "
|
167
|
+
- - ">"
|
193
168
|
- !ruby/object:Gem::Version
|
194
|
-
|
195
|
-
|
196
|
-
version: "0"
|
169
|
+
version: 1.3.1
|
170
|
+
version:
|
197
171
|
requirements: []
|
198
172
|
|
199
173
|
rubyforge_project: sinatra
|
200
|
-
rubygems_version: 1.3.
|
174
|
+
rubygems_version: 1.3.5
|
201
175
|
signing_key:
|
202
176
|
specification_version: 2
|
203
177
|
summary: Classy web-development dressed in a DSL
|
@@ -205,14 +179,13 @@ test_files:
|
|
205
179
|
- test/base_test.rb
|
206
180
|
- test/builder_test.rb
|
207
181
|
- test/erb_test.rb
|
182
|
+
- test/erubis_test.rb
|
208
183
|
- test/extensions_test.rb
|
209
184
|
- test/filter_test.rb
|
210
185
|
- test/haml_test.rb
|
211
186
|
- test/helpers_test.rb
|
212
187
|
- test/mapped_error_test.rb
|
213
188
|
- test/middleware_test.rb
|
214
|
-
- test/options_test.rb
|
215
|
-
- test/render_backtrace_test.rb
|
216
189
|
- test/request_test.rb
|
217
190
|
- test/response_test.rb
|
218
191
|
- test/result_test.rb
|
@@ -220,7 +193,7 @@ test_files:
|
|
220
193
|
- test/routing_test.rb
|
221
194
|
- test/sass_test.rb
|
222
195
|
- test/server_test.rb
|
196
|
+
- test/settings_test.rb
|
223
197
|
- test/sinatra_test.rb
|
224
198
|
- test/static_test.rb
|
225
199
|
- test/templates_test.rb
|
226
|
-
- test/test_test.rb
|
data/compat/app_test.rb
DELETED
@@ -1,282 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/helper'
|
2
|
-
|
3
|
-
context "Sinatra" do
|
4
|
-
|
5
|
-
setup do
|
6
|
-
Sinatra.application = nil
|
7
|
-
end
|
8
|
-
|
9
|
-
specify "should put all DSL methods on (main)" do
|
10
|
-
object = Object.new
|
11
|
-
methods = %w[get put post head delete configure template helpers set]
|
12
|
-
methods.each do |method|
|
13
|
-
object.private_methods.map { |m| m.to_sym }.should.include(method.to_sym)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
specify "should handle result of nil" do
|
18
|
-
get '/' do
|
19
|
-
nil
|
20
|
-
end
|
21
|
-
|
22
|
-
get_it '/'
|
23
|
-
should.be.ok
|
24
|
-
body.should == ''
|
25
|
-
end
|
26
|
-
|
27
|
-
specify "handles events" do
|
28
|
-
get '/:name' do
|
29
|
-
'Hello ' + params["name"]
|
30
|
-
end
|
31
|
-
|
32
|
-
get_it '/Blake'
|
33
|
-
|
34
|
-
should.be.ok
|
35
|
-
body.should.equal 'Hello Blake'
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
specify "handles splats" do
|
40
|
-
get '/hi/*' do
|
41
|
-
params["splat"].kind_of?(Array).should.equal true
|
42
|
-
params["splat"].first
|
43
|
-
end
|
44
|
-
|
45
|
-
get_it '/hi/Blake'
|
46
|
-
|
47
|
-
should.be.ok
|
48
|
-
body.should.equal 'Blake'
|
49
|
-
end
|
50
|
-
|
51
|
-
specify "handles multiple splats" do
|
52
|
-
get '/say/*/to/*' do
|
53
|
-
params["splat"].join(' ')
|
54
|
-
end
|
55
|
-
|
56
|
-
get_it '/say/hello/to/world'
|
57
|
-
|
58
|
-
should.be.ok
|
59
|
-
body.should.equal 'hello world'
|
60
|
-
end
|
61
|
-
|
62
|
-
specify "allow empty splats" do
|
63
|
-
get '/say/*/to*/*' do
|
64
|
-
params["splat"].join(' ')
|
65
|
-
end
|
66
|
-
|
67
|
-
get_it '/say/hello/to/world'
|
68
|
-
|
69
|
-
should.be.ok
|
70
|
-
body.should.equal 'hello world' # second splat is empty
|
71
|
-
|
72
|
-
get_it '/say/hello/tomy/world'
|
73
|
-
|
74
|
-
should.be.ok
|
75
|
-
body.should.equal 'hello my world'
|
76
|
-
end
|
77
|
-
|
78
|
-
specify "gives access to underlying response header Hash" do
|
79
|
-
get '/' do
|
80
|
-
header['X-Test'] = 'Is this thing on?'
|
81
|
-
headers 'X-Test2' => 'Foo', 'X-Test3' => 'Bar'
|
82
|
-
''
|
83
|
-
end
|
84
|
-
|
85
|
-
get_it '/'
|
86
|
-
should.be.ok
|
87
|
-
headers.should.include 'X-Test'
|
88
|
-
headers['X-Test'].should.equal 'Is this thing on?'
|
89
|
-
headers.should.include 'X-Test3'
|
90
|
-
headers['X-Test3'].should.equal 'Bar'
|
91
|
-
end
|
92
|
-
|
93
|
-
specify "follows redirects" do
|
94
|
-
get '/' do
|
95
|
-
redirect '/blake'
|
96
|
-
end
|
97
|
-
|
98
|
-
get '/blake' do
|
99
|
-
'Mizerany'
|
100
|
-
end
|
101
|
-
|
102
|
-
get_it '/'
|
103
|
-
should.be.redirection
|
104
|
-
body.should.equal ''
|
105
|
-
|
106
|
-
follow!
|
107
|
-
should.be.ok
|
108
|
-
body.should.equal 'Mizerany'
|
109
|
-
end
|
110
|
-
|
111
|
-
specify "renders a body with a redirect" do
|
112
|
-
helpers do
|
113
|
-
def foo ; 'blah' ; end
|
114
|
-
end
|
115
|
-
get "/" do
|
116
|
-
redirect 'foo', :foo
|
117
|
-
end
|
118
|
-
get_it '/'
|
119
|
-
should.be.redirection
|
120
|
-
headers['Location'].should.equal 'foo'
|
121
|
-
body.should.equal 'blah'
|
122
|
-
end
|
123
|
-
|
124
|
-
specify "redirects permanently with 301 status code" do
|
125
|
-
get "/" do
|
126
|
-
redirect 'foo', 301
|
127
|
-
end
|
128
|
-
get_it '/'
|
129
|
-
should.be.redirection
|
130
|
-
headers['Location'].should.equal 'foo'
|
131
|
-
status.should.equal 301
|
132
|
-
body.should.be.empty
|
133
|
-
end
|
134
|
-
|
135
|
-
specify "stop sets content and ends event" do
|
136
|
-
get '/set_body' do
|
137
|
-
stop 'Hello!'
|
138
|
-
stop 'World!'
|
139
|
-
fail 'stop should have halted'
|
140
|
-
end
|
141
|
-
|
142
|
-
get_it '/set_body'
|
143
|
-
|
144
|
-
should.be.ok
|
145
|
-
body.should.equal 'Hello!'
|
146
|
-
|
147
|
-
end
|
148
|
-
|
149
|
-
specify "should easily set response Content-Type" do
|
150
|
-
get '/foo.html' do
|
151
|
-
content_type 'text/html', :charset => 'utf-8'
|
152
|
-
"<h1>Hello, World</h1>"
|
153
|
-
end
|
154
|
-
|
155
|
-
get_it '/foo.html'
|
156
|
-
should.be.ok
|
157
|
-
headers['Content-Type'].should.equal 'text/html;charset=utf-8'
|
158
|
-
body.should.equal '<h1>Hello, World</h1>'
|
159
|
-
|
160
|
-
get '/foo_test.xml' do
|
161
|
-
content_type :xml
|
162
|
-
"<feed></feed>"
|
163
|
-
end
|
164
|
-
|
165
|
-
get_it '/foo_test.xml'
|
166
|
-
should.be.ok
|
167
|
-
headers['Content-Type'].should.equal 'application/xml'
|
168
|
-
body.should.equal '<feed></feed>'
|
169
|
-
end
|
170
|
-
|
171
|
-
specify "supports conditional GETs with last_modified" do
|
172
|
-
modified_at = Time.now
|
173
|
-
get '/maybe' do
|
174
|
-
last_modified modified_at
|
175
|
-
'response body, maybe'
|
176
|
-
end
|
177
|
-
|
178
|
-
get_it '/maybe'
|
179
|
-
should.be.ok
|
180
|
-
body.should.equal 'response body, maybe'
|
181
|
-
|
182
|
-
get_it '/maybe', :env => { 'HTTP_IF_MODIFIED_SINCE' => modified_at.httpdate }
|
183
|
-
status.should.equal 304
|
184
|
-
body.should.equal ''
|
185
|
-
end
|
186
|
-
|
187
|
-
specify "supports conditional GETs with entity_tag" do
|
188
|
-
get '/strong' do
|
189
|
-
entity_tag 'FOO'
|
190
|
-
'foo response'
|
191
|
-
end
|
192
|
-
|
193
|
-
get_it '/strong'
|
194
|
-
should.be.ok
|
195
|
-
body.should.equal 'foo response'
|
196
|
-
|
197
|
-
get_it '/strong', {},
|
198
|
-
'HTTP_IF_NONE_MATCH' => '"BAR"'
|
199
|
-
should.be.ok
|
200
|
-
body.should.equal 'foo response'
|
201
|
-
|
202
|
-
get_it '/strong', {},
|
203
|
-
'HTTP_IF_NONE_MATCH' => '"FOO"'
|
204
|
-
status.should.equal 304
|
205
|
-
body.should.equal ''
|
206
|
-
|
207
|
-
get_it '/strong', {},
|
208
|
-
'HTTP_IF_NONE_MATCH' => '"BAR", *'
|
209
|
-
status.should.equal 304
|
210
|
-
body.should.equal ''
|
211
|
-
end
|
212
|
-
|
213
|
-
specify "delegates HEAD requests to GET handlers" do
|
214
|
-
get '/invisible' do
|
215
|
-
"I am invisible to the world"
|
216
|
-
end
|
217
|
-
|
218
|
-
head_it '/invisible'
|
219
|
-
should.be.ok
|
220
|
-
body.should.not.equal "I am invisible to the world"
|
221
|
-
body.should.equal ''
|
222
|
-
end
|
223
|
-
|
224
|
-
|
225
|
-
specify "supports PUT" do
|
226
|
-
put '/' do
|
227
|
-
'puted'
|
228
|
-
end
|
229
|
-
put_it '/'
|
230
|
-
assert_equal 'puted', body
|
231
|
-
end
|
232
|
-
|
233
|
-
specify "rewrites POSTs with _method param to PUT" do
|
234
|
-
put '/' do
|
235
|
-
'puted'
|
236
|
-
end
|
237
|
-
post_it '/', :_method => 'PUT'
|
238
|
-
assert_equal 'puted', body
|
239
|
-
end
|
240
|
-
|
241
|
-
specify "rewrites POSTs with lowercase _method param to PUT" do
|
242
|
-
put '/' do
|
243
|
-
'puted'
|
244
|
-
end
|
245
|
-
post_it '/', :_method => 'put'
|
246
|
-
body.should.equal 'puted'
|
247
|
-
end
|
248
|
-
|
249
|
-
specify "does not rewrite GETs with _method param to PUT" do
|
250
|
-
get '/' do
|
251
|
-
'getted'
|
252
|
-
end
|
253
|
-
get_it '/', :_method => 'put'
|
254
|
-
should.be.ok
|
255
|
-
body.should.equal 'getted'
|
256
|
-
end
|
257
|
-
|
258
|
-
specify "ignores _method query string parameter on non-POST requests" do
|
259
|
-
post '/' do
|
260
|
-
'posted'
|
261
|
-
end
|
262
|
-
put '/' do
|
263
|
-
'booo'
|
264
|
-
end
|
265
|
-
post_it "/?_method=PUT"
|
266
|
-
should.be.ok
|
267
|
-
body.should.equal 'posted'
|
268
|
-
end
|
269
|
-
|
270
|
-
specify "does not read body if content type is not url encoded" do
|
271
|
-
post '/foo.xml' do
|
272
|
-
request.env['CONTENT_TYPE'].should.be == 'application/xml'
|
273
|
-
request.content_type.should.be == 'application/xml'
|
274
|
-
request.body.read
|
275
|
-
end
|
276
|
-
|
277
|
-
post_it '/foo.xml', '<foo></foo>', :content_type => 'application/xml'
|
278
|
-
@response.should.be.ok
|
279
|
-
@response.body.should.be == '<foo></foo>'
|
280
|
-
end
|
281
|
-
|
282
|
-
end
|