2012-11-29 19:44:12 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Zero::Request::Parameter, '#custom' do
|
|
|
|
subject { Zero::Request::Parameter.new(env) }
|
|
|
|
let(:env) { EnvGenerator.get('/foo') }
|
|
|
|
|
|
|
|
it 'returns a set custom parameter' do
|
|
|
|
subject['foo'] = 'bar'
|
|
|
|
expect(subject.custom['foo']).to eq('bar')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns the latest set value' do
|
|
|
|
subject['foo'] = 'first'
|
|
|
|
subject['foo'] = 'latest'
|
|
|
|
|
|
|
|
expect(subject.custom['foo']).to eq('latest')
|
|
|
|
end
|
2013-01-06 10:28:13 +01:00
|
|
|
|
|
|
|
it 'is empty if no custom parameter is set' do
|
|
|
|
expect(subject.custom).to eq({})
|
|
|
|
expect(env['zero.params.custom']).to eq({})
|
|
|
|
end
|
2012-11-29 19:44:12 +01:00
|
|
|
end
|