diff options
author | Gibheer <gibheer@gmail.com> | 2012-12-17 19:00:01 +0100 |
---|---|---|
committer | Gibheer <gibheer@gmail.com> | 2012-12-17 19:22:20 +0100 |
commit | 6fbb12c0fd1f304fe99feadbf2eeb8d3c1245d11 (patch) | |
tree | ae2a185cf386ef6f45f5b0551ac5699e65952a44 /spec/unit/request/parameter/element_reference_spec.rb | |
parent | daee3c597571ef7e981abbbca4862e9f482e11df (diff) |
cleanup gemfile for jruby on travis
Diffstat (limited to 'spec/unit/request/parameter/element_reference_spec.rb')
-rw-r--r-- | spec/unit/request/parameter/element_reference_spec.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/unit/request/parameter/element_reference_spec.rb b/spec/unit/request/parameter/element_reference_spec.rb new file mode 100644 index 0000000..1136eae --- /dev/null +++ b/spec/unit/request/parameter/element_reference_spec.rb @@ -0,0 +1,56 @@ +require 'spec_helper' + +describe Zero::Request::Parameter, '#[]' do + subject { Zero::Request::Parameter.new(env) } + + context 'without parameters' do + let(:env) { EnvGenerator.get('/foo') } + + it 'returns the custom parameter' do + subject['foo'] = 'bar' + expect(subject['foo']).to eq('bar') + end + end + + context 'with query parameters' do + let(:env) { EnvGenerator.get('/foo?foo=bar') } + + it 'returns the query parameter' do + expect(subject['foo']).to eq('bar') + end + + it 'returns the custom parameter' do + subject['foo'] = 'baz' + expect(subject['foo']).to eq('baz') + end + end + + context 'with payload parameters' do + let(:env) do + EnvGenerator.post('/foo', { + :input => 'foo=bar', 'CONTENT_TYPE' => 'multipart/form-data' + }) + end + + it 'returns the payload value' do + expect(subject['foo']).to eq('bar') + end + + it 'returns the custom parameter' do + subject['foo'] = 'baz' + expect(subject['foo']).to eq('baz') + end + end + + context 'with query and payload parameters' do + let(:env) do + EnvGenerator.post('/foo?foo=baz', { + :input => 'foo=bar', 'CONTENT_TYPE' => 'multipart/form-data' + }) + end + + it 'returns the payload parameter' do + expect(subject['foo']).to eq('bar') + end + end +end |