Sha256: 58e1578fa5f5e74dff306159690f2b1c87dcf047eb4327b900dd1ab0ad3bf0f1

Contents?: true

Size: 661 Bytes

Versions: 5

Compression:

Stored size: 661 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

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

      params do
        requires :a_boolean, type: Grape::API::Boolean
      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 boolean types' do
    expect(subject).to eq [
      { 'in' => 'formData', 'name' => 'a_boolean', 'type' => 'boolean', 'required' => true }
    ]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
grape-swagger-1.3.0 spec/swagger_v2/boolean_params_spec.rb
grape-swagger-1.2.1 spec/swagger_v2/boolean_params_spec.rb
grape-swagger-1.2.0 spec/swagger_v2/boolean_params_spec.rb
grape-swagger-1.1.0 spec/swagger_v2/boolean_params_spec.rb
grape-swagger-1.0.0 spec/swagger_v2/boolean_params_spec.rb