File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'Boolean Params' do
6
+ def app
7
+ Class . new ( Grape ::API ) do
8
+ format :json
9
+
10
+ params do
11
+ requires :a_boolean , type : Virtus ::Attribute ::Boolean
12
+ end
13
+ post :splines do
14
+ end
15
+
16
+ add_swagger_documentation openapi_version : '3.0'
17
+ end
18
+ end
19
+
20
+ subject do
21
+ get '/swagger_doc/splines'
22
+ expect ( last_response . status ) . to eq 200
23
+ body = JSON . parse last_response . body
24
+ body [ 'paths' ] [ '/splines' ] [ 'post' ] [ 'requestBody' ] [ 'content' ] [ 'application/x-www-form-urlencoded' ]
25
+ end
26
+
27
+ it 'converts boolean types' do
28
+ expect ( subject ) . to eq (
29
+ 'schema' => {
30
+ 'properties' => {
31
+ 'a_boolean' => { 'type' => 'boolean' }
32
+ } ,
33
+ 'required' => [ 'a_boolean' ] ,
34
+ 'type' => 'object'
35
+ }
36
+ )
37
+ end
38
+ end
You can’t perform that action at this time.
0 commit comments