Sha256: d37b94cc3e8fe02af0c68bc76e8d28a8b87cece9e3c2ae4050d8331964876278

Contents?: true

Size: 628 Bytes

Versions: 11

Compression:

Stored size: 628 Bytes

Contents

require 'spec_helper'

describe 'Float Params' do
  def app
    Class.new(Grape::API) do
      format :json

      params do
        requires :a_float, type: Float
      end
      post :splines do
      end

      add_swagger_documentation
    end
  end

  subject do
    get '/swagger_doc/splines'
    expect(last_response.status).to eq 200
    body = JSON.parse last_response.body
    body['paths']['/splines']['post']['parameters']
  end

  it 'converts float types' do
    expect(subject).to eq [
      { 'in' => 'formData', 'name' => 'a_float', 'type' => 'number', 'required' => true, 'format' => 'float' }
    ]
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
grape-swagger-0.26.1 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.26.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.25.3 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.25.2 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.25.1 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.25.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.24.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.23.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.22.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.21.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.20.3 spec/swagger_v2/float_api_spec.rb