Sha256: 55c3b3ddfc82d1e09eb0c86815610a1d578321064b99d2e19f78b701d6b8c555

Contents?: true

Size: 659 Bytes

Versions: 21

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true

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

21 entries across 21 versions & 1 rubygems

Version Path
grape-swagger-1.3.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-1.2.1 spec/swagger_v2/float_api_spec.rb
grape-swagger-1.2.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-1.1.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-1.0.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.34.2 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.34.1 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.34.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.33.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.32.1 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.32.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.31.1 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.31.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.30.1 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.30.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.29.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.28.0 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.27.3 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.27.2 spec/swagger_v2/float_api_spec.rb
grape-swagger-0.27.1 spec/swagger_v2/float_api_spec.rb