12
12
13
13
let ( :controller_class ) { described_class }
14
14
15
- def print_swagger
16
- puts JSON . generate ( swagger )
17
- end
18
-
19
15
def swagger_response_for ( path , code = 200 , method = 'get' )
20
16
swagger [ :paths ] [ path ] [ method ] [ :responses ] [ code ]
21
17
end
@@ -45,7 +41,6 @@ def swagger_param_by_name(param_name, path, method='get')
45
41
end
46
42
47
43
it "should return code 200 with array of entries of the format {'pet_name', 'animal_type'}" do
48
- print_swagger
49
44
returns_obj = subject . returns . detect { |e | e . code == 200 }
50
45
51
46
puts returns_obj . to_json
@@ -56,7 +51,6 @@ def swagger_param_by_name(param_name, path, method='get')
56
51
end
57
52
58
53
it 'should have the response described in the swagger' do
59
- print_swagger
60
54
response = swagger_response_for ( '/pets' )
61
55
expect ( response [ :description ] ) . to eq ( "list of pets" )
62
56
@@ -70,10 +64,8 @@ def swagger_param_by_name(param_name, path, method='get')
70
64
71
65
72
66
it "should return code 401 with a String description field" do
73
- # print_swagger
74
67
returns_obj = subject . returns . detect { |e | e . code == 404 }
75
68
76
- # puts returns_obj.to_json
77
69
expect ( returns_obj . code ) . to eq ( 404 )
78
70
expect ( returns_obj . is_array? ) . to eq ( false )
79
71
@@ -82,18 +74,15 @@ def swagger_param_by_name(param_name, path, method='get')
82
74
83
75
84
76
it "should return code 401 with a :reason field (defined in the superclass)" do
85
- # print_swagger
86
77
returns_obj = subject . returns . detect { |e | e . code == 401 }
87
78
88
- # puts returns_obj.to_json
89
79
expect ( returns_obj . code ) . to eq ( 401 )
90
80
expect ( returns_obj . is_array? ) . to eq ( false )
91
81
92
82
expect ( returns_obj ) . to match_field_structure ( [ :reason ] )
93
83
end
94
84
95
85
it 'should have the 404 response described in the swagger' do
96
- print_swagger
97
86
response = swagger_response_for ( '/pets' , 404 )
98
87
expect ( response [ :description ] ) . to eq ( "Not Found" )
99
88
@@ -130,7 +119,6 @@ def swagger_param_by_name(param_name, path, method='get')
130
119
end
131
120
132
121
it 'should have the 404 response description overridden' do
133
- # print_swagger
134
122
returns_obj = subject . returns . detect { |e | e . code == 404 }
135
123
136
124
# puts returns_obj.to_json
@@ -372,7 +360,6 @@ def swagger_param_by_name(param_name, path, method='get')
372
360
end
373
361
374
362
it "should return code 200 with array of entries of the format {'pet_name', 'animal_type'}" do
375
- print_swagger
376
363
returns_obj = subject . returns . detect { |e | e . code == 200 }
377
364
378
365
puts returns_obj . to_json
@@ -383,7 +370,6 @@ def swagger_param_by_name(param_name, path, method='get')
383
370
end
384
371
385
372
it 'should have the response described in the swagger' do
386
- print_swagger
387
373
response = swagger_response_for ( '/pets_described_as_class' )
388
374
expect ( response [ :description ] ) . to eq ( "list of pets" )
389
375
@@ -478,18 +464,14 @@ def swagger_param_by_name(param_name, path, method='get')
478
464
end
479
465
480
466
it "should return code 200 with array of entries of the format {'pet_name', 'animal_type'}" do
481
- print_swagger
482
467
returns_obj = subject . returns . detect { |e | e . code == 200 }
483
468
484
- puts returns_obj . to_json
485
469
expect ( returns_obj . code ) . to eq ( 200 )
486
470
expect ( returns_obj . is_array? ) . to eq ( false )
487
-
488
471
expect ( returns_obj ) . to match_field_structure ( [ :pet_name , :animal_type , :age ] )
489
472
end
490
473
491
474
it 'should have the response described in the swagger' do
492
- print_swagger
493
475
response = swagger_response_for ( '/pet_described_using_automated_view/{id}' )
494
476
expect ( response [ :description ] ) . to eq ( "like Pet, but different" )
495
477
0 commit comments