Sha256: 17f7fa9a2c1e1f623b214b33f0f60addd3023aa66c086931463bdaf0c7587325
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require 'spec_helper' describe 'Params Types' do def app Class.new(Grape::API) do format :json params do requires :input, type: String end post :action do end add_swagger_documentation end end subject do get '/swagger_doc/action' expect(last_response.status).to eq 200 body = JSON.parse last_response.body body['paths']['/action']['post']['parameters'] end it 'reads param type correctly' do expect(subject).to eq [{ 'in' => 'formData', 'name' => 'input', 'type' => 'string', 'required' => true }] end describe 'header params' do def app Class.new(Grape::API) do format :json desc 'Some API', headers: { 'My-Header' => { required: true, description: 'Set this!' } } params do requires :input, type: String end post :action do end add_swagger_documentation end end it 'has consistent types' do types = subject.map { |param| param['type'] } expect(types).to eq(%w(string string)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
grape-swagger-0.21.0 | spec/swagger_v2/param_type_spec.rb |
grape-swagger-0.20.3 | spec/swagger_v2/param_type_spec.rb |