blob: af1d2abacd10a929cc3f3a1bfbf94c374293524e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
require 'spec_helper'
describe Zero::Request::Parameter, '#payload' do
subject { Zero::Request::Parameter.new(env) }
context 'without parameters' do
let(:env) { EnvGenerator.get('/foo') }
its(:payload) { should == {} }
end
context 'with a query string' do
let(:env) { EnvGenerator.get('/foo?bar=baz') }
its(:payload) { should == {} }
end
context 'with a post body' do
let(:env) do
EnvGenerator.post('/foo', {
:input => 'bar=baz', 'CONTENT_TYPE' => 'multipart/form-data'
})
end
its(:payload) { should == {'bar' => 'baz'} }
end
context 'with special characters' do
let(:env) do
EnvGenerator.post('/foo', {
:input => 'bar=foo%20bar', 'CONTENT_TYPE' => 'multipart/form-data'
})
end
its(:payload) { should == {'bar' => 'foo bar'} }
end
end
|