Sha256: cefca36e35336f60de8a3439173afb0c2e9002d00784d662785d39ea5c9b010d
Contents?: true
Size: 886 Bytes
Versions: 18
Compression:
Stored size: 886 Bytes
Contents
require 'spec_helper' describe Grape::Endpoint do subject { Class.new(Grape::API) } def app subject end before do subject.namespace :test do params do optional :foo, default: '-abcdef' end get do params[:foo].slice!(0) params[:foo] end end end context 'when route modifies param value' do it 'param default should not change' do get '/test' expect(last_response.status).to eq 200 expect(last_response.body).to eq 'abcdef' get '/test' expect(last_response.status).to eq 200 expect(last_response.body).to eq 'abcdef' get '/test?foo=-123456' expect(last_response.status).to eq 200 expect(last_response.body).to eq '123456' get '/test' expect(last_response.status).to eq 200 expect(last_response.body).to eq 'abcdef' end end end
Version data entries
18 entries across 18 versions & 2 rubygems