grape-swagger 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,70 +1,103 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "options: " do
4
- context "overruling the basepath" do
5
- before(:all) do
4
+ context "overriding the basepath" do
5
+ before :all do
6
+
6
7
  class BasePathMountedApi < Grape::API
7
- desc 'this gets something'
8
+ desc 'This gets something.'
8
9
  get '/something' do
9
- {:bla => 'something'}
10
+ { bla: 'something' }
10
11
  end
11
12
  end
12
13
 
13
14
  class SimpleApiWithBasePath < Grape::API
14
- NON_DEFAULT_BASE_PATH= "http://www.breakcoregivesmewood.com"
15
+ NON_DEFAULT_BASE_PATH = "http://www.breakcoregivesmewood.com"
15
16
 
16
17
  mount BasePathMountedApi
17
18
  add_swagger_documentation :base_path => NON_DEFAULT_BASE_PATH
18
19
  end
20
+
19
21
  end
20
22
 
21
23
  def app; SimpleApiWithBasePath end
22
24
 
23
25
  it "retrieves the given base-path on /swagger_doc" do
24
- get '/swagger_doc'
25
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"#{SimpleApiWithBasePath::NON_DEFAULT_BASE_PATH}\", :operations=>[], :apis=>[{:path=>\"/swagger_doc/something.{format}\"}, {:path=>\"/swagger_doc/swagger_doc.{format}\"}]}"
26
+ get '/swagger_doc.json'
27
+ JSON.parse(last_response.body)["basePath"].should == SimpleApiWithBasePath::NON_DEFAULT_BASE_PATH
26
28
  end
27
29
 
28
30
  it "retrieves the same given base-path for mounted-api" do
29
- get '/swagger_doc/something'
30
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"#{SimpleApiWithBasePath::NON_DEFAULT_BASE_PATH}\", :resourcePath=>\"\", :apis=>[{:path=>\"/something.{format}\", :operations=>[{:notes=>nil, :summary=>\"this gets something\", :nickname=>\"GET-something---format-\", :httpMethod=>\"GET\", :parameters=>[]}]}]}"
31
+ get '/swagger_doc/something.json'
32
+ JSON.parse(last_response.body)["basePath"].should == SimpleApiWithBasePath::NON_DEFAULT_BASE_PATH
31
33
  end
32
34
  end
33
35
 
34
- context "overruling the basepath with a proc" do
35
- before(:all) do
36
+ context "overriding the basepath with a proc" do
37
+ before :all do
38
+
36
39
  class ProcBasePathMountedApi < Grape::API
37
- desc 'this gets something'
40
+ desc 'This gets something.'
38
41
  get '/something' do
39
- {:bla => 'something'}
42
+ { bla: 'something' }
40
43
  end
41
44
  end
42
45
 
43
46
  class SimpleApiWithProcBasePath < Grape::API
44
47
  mount ProcBasePathMountedApi
45
- add_swagger_documentation :base_path => lambda { |request| "#{request.base_url}/some_value" }
48
+ add_swagger_documentation base_path: lambda { |request| "#{request.base_url}/some_value" }
46
49
  end
47
50
  end
48
51
 
49
52
  def app; SimpleApiWithProcBasePath end
50
53
 
51
54
  it "retrieves the given base-path on /swagger_doc" do
52
- get '/swagger_doc'
53
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org/some_value\", :operations=>[], :apis=>[{:path=>\"/swagger_doc/something.{format}\"}, {:path=>\"/swagger_doc/swagger_doc.{format}\"}]}"
55
+ get '/swagger_doc.json'
56
+ JSON.parse(last_response.body)["basePath"].should == "http://example.org/some_value"
54
57
  end
55
58
 
56
59
  it "retrieves the same given base-path for mounted-api" do
57
- get '/swagger_doc/something'
58
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org/some_value\", :resourcePath=>\"\", :apis=>[{:path=>\"/something.{format}\", :operations=>[{:notes=>nil, :summary=>\"this gets something\", :nickname=>\"GET-something---format-\", :httpMethod=>\"GET\", :parameters=>[]}]}]}"
60
+ get '/swagger_doc/something.json'
61
+ JSON.parse(last_response.body)["basePath"].should == "http://example.org/some_value"
59
62
  end
60
63
  end
61
64
 
62
- context "overruling the version" do
63
- before(:all) do
65
+ context "relative base_path" do
66
+ before :all do
67
+
68
+ class RelativeBasePathMountedApi < Grape::API
69
+ desc 'This gets something.'
70
+ get '/something' do
71
+ { bla: 'something' }
72
+ end
73
+ end
74
+
75
+ class SimpleApiWithRelativeBasePath < Grape::API
76
+ mount RelativeBasePathMountedApi
77
+ add_swagger_documentation base_path: "/some_value"
78
+ end
79
+ end
80
+
81
+ def app; SimpleApiWithRelativeBasePath end
82
+
83
+ it "retrieves the given base-path on /swagger_doc" do
84
+ get '/swagger_doc.json'
85
+ JSON.parse(last_response.body)["basePath"].should == "http://example.org/some_value"
86
+ end
87
+
88
+ it "retrieves the same given base-path for mounted-api" do
89
+ get '/swagger_doc/something.json'
90
+ JSON.parse(last_response.body)["basePath"].should == "http://example.org/some_value"
91
+ end
92
+ end
93
+
94
+ context "overriding the version" do
95
+ before :all do
96
+
64
97
  class ApiVersionMountedApi < Grape::API
65
- desc 'this gets something'
98
+ desc 'This gets something.'
66
99
  get '/something' do
67
- {:bla => 'something'}
100
+ { bla: 'something' }
68
101
  end
69
102
  end
70
103
 
@@ -79,22 +112,23 @@ describe "options: " do
79
112
  def app; SimpleApiWithApiVersion end
80
113
 
81
114
  it "retrieves the api version on /swagger_doc" do
82
- get '/swagger_doc'
83
- last_response.body.should == "{:apiVersion=>\"#{SimpleApiWithApiVersion::API_VERSION}\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org\", :operations=>[], :apis=>[{:path=>\"/swagger_doc/something.{format}\"}, {:path=>\"/swagger_doc/swagger_doc.{format}\"}]}"
115
+ get '/swagger_doc.json'
116
+ JSON.parse(last_response.body)["apiVersion"].should == SimpleApiWithApiVersion::API_VERSION
84
117
  end
85
118
 
86
119
  it "retrieves the same api version for mounted-api" do
87
- get '/swagger_doc/something'
88
- last_response.body.should == "{:apiVersion=>\"#{SimpleApiWithApiVersion::API_VERSION}\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org\", :resourcePath=>\"\", :apis=>[{:path=>\"/something.{format}\", :operations=>[{:notes=>nil, :summary=>\"this gets something\", :nickname=>\"GET-something---format-\", :httpMethod=>\"GET\", :parameters=>[]}]}]}"
120
+ get '/swagger_doc/something.json'
121
+ JSON.parse(last_response.body)["apiVersion"].should == SimpleApiWithApiVersion::API_VERSION
89
122
  end
90
123
  end
91
124
 
92
125
  context "mounting in a versioned api" do
93
- before(:all) do
126
+ before :all do
127
+
94
128
  class SimpleApiToMountInVersionedApi < Grape::API
95
- desc 'this gets something'
129
+ desc 'This gets something.'
96
130
  get '/something' do
97
- {:bla => 'something'}
131
+ { bla: 'something' }
98
132
  end
99
133
  end
100
134
 
@@ -108,25 +142,54 @@ describe "options: " do
108
142
 
109
143
  def app; SimpleApiWithVersionInPath end
110
144
 
111
- it "should get the documentation on a versioned path /v1/swagger_doc" do
112
- get '/v1/swagger_doc'
113
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org\", :operations=>[], :apis=>[{:path=>\"/v1/swagger_doc/something.{format}\"}, {:path=>\"/v1/swagger_doc/swagger_doc.{format}\"}]}"
145
+ it "gets the documentation on a versioned path /v1/swagger_doc" do
146
+ get '/v1/swagger_doc.json'
147
+
148
+ JSON.parse(last_response.body).should == {
149
+ "apiVersion" => "0.1",
150
+ "swaggerVersion" => "1.2",
151
+ "basePath" => "http://example.org",
152
+ "info" => {},
153
+ "produces" => ["application/xml", "application/json", "text/plain"],
154
+ "operations" => [],
155
+ "apis" => [
156
+ { "path" => "/v1/something.{format}" },
157
+ { "path" => "/v1/swagger_doc.{format}" }
158
+ ]
159
+ }
114
160
  end
115
161
 
116
- it "should get the resource specific documentation on a versioned path /v1/swagger_doc/something" do
117
- get '/v1/swagger_doc/something'
162
+ it "gets the resource specific documentation on a versioned path /v1/swagger_doc/something" do
163
+ get '/v1/swagger_doc/something.json'
118
164
  last_response.status.should == 200
165
+ JSON.parse(last_response.body).should == {
166
+ "apiVersion" => "0.1",
167
+ "swaggerVersion" => "1.2",
168
+ "basePath" => "http://example.org",
169
+ "resourcePath" => "",
170
+ "apis" => [{
171
+ "path" => "/0.1/something.{format}",
172
+ "operations" => [{
173
+ "produces" => ["application/xml", "application/json", "text/plain"],
174
+ "notes" => nil,
175
+ "notes" => "",
176
+ "summary" => "This gets something.",
177
+ "nickname" => "GET--version-something---format-",
178
+ "httpMethod" => "GET",
179
+ "parameters" => []
180
+ }]
181
+ }]
182
+ }
119
183
  end
120
184
 
121
185
  end
122
186
 
123
-
124
- context "overruling hiding the documentation paths" do
125
- before(:all) do
187
+ context "overriding hiding the documentation paths" do
188
+ before :all do
126
189
  class HideDocumentationPathMountedApi < Grape::API
127
- desc 'this gets something'
190
+ desc 'This gets something.'
128
191
  get '/something' do
129
- {:bla => 'something'}
192
+ { bla: 'something' }
130
193
  end
131
194
  end
132
195
 
@@ -139,17 +202,116 @@ describe "options: " do
139
202
  def app; SimpleApiWithHiddenDocumentation end
140
203
 
141
204
  it "it doesn't show the documentation path on /swagger_doc" do
142
- get '/swagger_doc'
143
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org\", :operations=>[], :apis=>[{:path=>\"/swagger_doc/something.{format}\"}]}"
205
+ get '/swagger_doc.json'
206
+ JSON.parse(last_response.body).should == {
207
+ "apiVersion" => "0.1",
208
+ "swaggerVersion" => "1.2",
209
+ "basePath" => "http://example.org",
210
+ "info" => {},
211
+ "produces" => ["application/xml", "application/json", "text/plain"],
212
+ "operations" => [],
213
+ "apis" => [
214
+ { "path" => "/something.{format}" }
215
+ ]
216
+ }
144
217
  end
145
218
  end
146
219
 
147
- context "overruling the mount-path" do
148
- before(:all) do
220
+ context "overriding hiding the documentation paths in prefixed API" do
221
+ before :all do
222
+ class HideDocumentationPathPrefixedMountedApi < Grape::API
223
+ desc 'This gets something.'
224
+ get '/something' do
225
+ { bla: 'something' }
226
+ end
227
+ end
228
+
229
+ class PrefixedApiWithHiddenDocumentation < Grape::API
230
+ prefix "abc"
231
+ mount HideDocumentationPathPrefixedMountedApi
232
+ add_swagger_documentation :hide_documentation_path => true
233
+ end
234
+
235
+ end
236
+
237
+ def app; PrefixedApiWithHiddenDocumentation end
238
+
239
+ it "it doesn't show the documentation path on /abc/swagger_doc/something.json" do
240
+ get '/abc/swagger_doc/something.json'
241
+ JSON.parse(last_response.body).should == {
242
+ "apiVersion"=>"0.1",
243
+ "swaggerVersion"=>"1.2",
244
+ "basePath"=>"http://example.org",
245
+ "resourcePath"=>"",
246
+ "apis"=> [{
247
+ "path"=>"/abc/something.{format}",
248
+ "operations"=> [{
249
+ "produces" => ["application/xml", "application/json", "text/plain"],
250
+ "notes"=>nil,
251
+ "notes"=>"",
252
+ "summary"=>"This gets something.",
253
+ "nickname"=>"GET-abc-something---format-",
254
+ "httpMethod"=>"GET",
255
+ "parameters"=>[]
256
+ }]
257
+ }]
258
+ }
259
+ end
260
+
261
+ end
262
+
263
+ context "overriding hiding the documentation paths in prefixed and versioned API" do
264
+ before :all do
265
+ class HideDocumentationPathMountedApi2 < Grape::API
266
+ desc 'This gets something.'
267
+ get '/something' do
268
+ { bla: 'something' }
269
+ end
270
+ end
271
+
272
+ class PrefixedAndVersionedApiWithHiddenDocumentation < Grape::API
273
+ prefix "abc"
274
+ version 'v20', :using => :path
275
+
276
+ mount HideDocumentationPathMountedApi2
277
+
278
+ add_swagger_documentation :hide_documentation_path => true, :api_version => self.version
279
+ end
280
+ end
281
+
282
+ def app; PrefixedAndVersionedApiWithHiddenDocumentation end
283
+
284
+ it "it doesn't show the documentation path on /abc/v1/swagger_doc/something.json" do
285
+ get '/abc/v20/swagger_doc/something.json'
286
+
287
+ JSON.parse(last_response.body).should == {
288
+ "apiVersion"=>"v20",
289
+ "swaggerVersion"=>"1.2",
290
+ "basePath"=>"http://example.org",
291
+ "resourcePath"=>"",
292
+ "apis"=>[{
293
+ "path"=>"/abc/v20/something.{format}",
294
+ "operations"=>[{
295
+ "produces" => ["application/xml", "application/json", "text/plain"],
296
+ "notes"=>nil,
297
+ "notes"=>"",
298
+ "summary"=>"This gets something.",
299
+ "nickname"=>"GET-abc--version-something---format-",
300
+ "httpMethod"=>"GET",
301
+ "parameters"=>[]
302
+ }]
303
+ }]
304
+ }
305
+ end
306
+
307
+ end
308
+
309
+ context "overriding the mount-path" do
310
+ before :all do
149
311
  class DifferentMountMountedApi < Grape::API
150
- desc 'this gets something'
312
+ desc 'This gets something.'
151
313
  get '/something' do
152
- {:bla => 'something'}
314
+ { bla: 'something' }
153
315
  end
154
316
  end
155
317
 
@@ -163,30 +325,28 @@ describe "options: " do
163
325
 
164
326
  def app; SimpleApiWithDifferentMount end
165
327
 
166
- it "retrieves the given base-path on /api_doc" do
167
- get '/api_doc'
168
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org\", :operations=>[], :apis=>[{:path=>\"/api_doc/something.{format}\"}, {:path=>\"/api_doc/api_doc.{format}\"}]}"
169
- end
170
328
 
171
329
  it "retrieves the same given base-path for mounted-api" do
172
- get '/api_doc/something'
173
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org\", :resourcePath=>\"\", :apis=>[{:path=>\"/something.{format}\", :operations=>[{:notes=>nil, :summary=>\"this gets something\", :nickname=>\"GET-something---format-\", :httpMethod=>\"GET\", :parameters=>[]}]}]}"
330
+ get '/api_doc/something.json'
331
+ JSON.parse(last_response.body)["apis"].each do |api|
332
+ api["path"].should_not start_with SimpleApiWithDifferentMount::MOUNT_PATH
333
+ end
174
334
  end
175
335
 
176
336
  it "does not respond to swagger_doc" do
177
- get '/swagger_doc'
337
+ get '/swagger_doc.json'
178
338
  last_response.status.should be == 404
179
339
  end
180
340
  end
181
341
 
182
- context "overruling the markdown" do
183
- before(:all) do
342
+ context "overriding the markdown" do
343
+ before :all do
184
344
  class MarkDownMountedApi < Grape::API
185
- desc 'this gets something', {
345
+ desc 'This gets something.', {
186
346
  :notes => '_test_'
187
347
  }
188
348
  get '/something' do
189
- {:bla => 'something'}
349
+ { bla: 'something' }
190
350
  end
191
351
  end
192
352
 
@@ -199,20 +359,36 @@ describe "options: " do
199
359
  def app; SimpleApiWithMarkdown end
200
360
 
201
361
  it "parses markdown for a mounted-api" do
202
- get '/swagger_doc/something'
203
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org\", :resourcePath=>\"\", :apis=>[{:path=>\"/something.{format}\", :operations=>[{:notes=>\"<p><em>test</em></p>\\n\", :summary=>\"this gets something\", :nickname=>\"GET-something---format-\", :httpMethod=>\"GET\", :parameters=>[]}]}]}"
362
+ get '/swagger_doc/something.json'
363
+ JSON.parse(last_response.body).should == {
364
+ "apiVersion" => "0.1",
365
+ "swaggerVersion" => "1.2",
366
+ "basePath" => "http://example.org",
367
+ "resourcePath" => "",
368
+ "apis" => [{
369
+ "path" => "/something.{format}",
370
+ "operations" => [{
371
+ "produces" => ["application/xml", "application/json", "text/plain"],
372
+ "notes" => "<p><em>test</em></p>\n",
373
+ "summary" => "This gets something.",
374
+ "nickname" => "GET-something---format-",
375
+ "httpMethod" => "GET",
376
+ "parameters" => []
377
+ }]
378
+ }]
379
+ }
204
380
  end
205
381
  end
206
382
 
207
- context "versioned API" do
208
- before(:all) do
383
+ context "prefixed and versioned API" do
384
+ before :all do
209
385
  class VersionedMountedApi < Grape::API
210
386
  prefix 'api'
211
387
  version 'v1'
212
388
 
213
- desc 'this gets something'
389
+ desc 'This gets something.'
214
390
  get '/something' do
215
- {:bla => 'something'}
391
+ { bla: 'something' }
216
392
  end
217
393
  end
218
394
 
@@ -225,17 +401,20 @@ describe "options: " do
225
401
  def app; SimpleApiWithVersion end
226
402
 
227
403
  it "parses version and places it in the path" do
228
- get '/swagger_doc/api'
229
- last_response.body.should == "{:apiVersion=>\"v1\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org\", :resourcePath=>\"\", :apis=>[{:path=>\"/api/v1/something.{format}\", :operations=>[{:notes=>nil, :summary=>\"this gets something\", :nickname=>\"GET-api--version-something---format-\", :httpMethod=>\"GET\", :parameters=>[]}]}]}"
404
+ get '/swagger_doc/something.json'
405
+
406
+ JSON.parse(last_response.body)["apis"].each do |api|
407
+ api["path"].should start_with "/api/v1/"
408
+ end
230
409
  end
231
410
  end
232
411
 
233
412
  context "protected API" do
234
- before(:all) do
413
+ before :all do
235
414
  class ProtectedApi < Grape::API
236
- desc 'this gets something'
415
+ desc 'This gets something.'
237
416
  get '/something' do
238
- {:bla => 'something'}
417
+ { bla: 'something' }
239
418
  end
240
419
  end
241
420
 
@@ -247,23 +426,23 @@ describe "options: " do
247
426
 
248
427
  def app; SimpleApiWithProtection; end
249
428
 
250
- it "should use https schema in mount point" do
251
- get '/swagger_doc', {}, 'rack.url_scheme' => 'https'
252
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"https://example.org:80\", :operations=>[], :apis=>[{:path=>\"/swagger_doc/something.{format}\"}, {:path=>\"/swagger_doc/swagger_doc.{format}\"}]}"
429
+ it "uses https schema in mount point" do
430
+ get '/swagger_doc.json', {}, 'rack.url_scheme' => 'https'
431
+ JSON.parse(last_response.body)["basePath"].should == "https://example.org:80"
253
432
  end
254
433
 
255
- it "should use https schema in endpoint doc" do
256
- get '/swagger_doc/something', {}, 'rack.url_scheme' => 'https'
257
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"https://example.org:80\", :resourcePath=>\"\", :apis=>[{:path=>\"/something.{format}\", :operations=>[{:notes=>nil, :summary=>\"this gets something\", :nickname=>\"GET-something---format-\", :httpMethod=>\"GET\", :parameters=>[]}]}]}"
434
+ it "uses https schema in endpoint doc" do
435
+ get '/swagger_doc/something.json', {}, 'rack.url_scheme' => 'https'
436
+ JSON.parse(last_response.body)["basePath"].should == "https://example.org:80"
258
437
  end
259
438
  end
260
439
 
261
440
  context ":hide_format" do
262
- before(:all) do
441
+ before :all do
263
442
  class HidePathsApi < Grape::API
264
- desc 'this gets something'
443
+ desc 'This gets something.'
265
444
  get '/something' do
266
- {:bla => 'something'}
445
+ { bla: 'something' }
267
446
  end
268
447
  end
269
448
 
@@ -276,8 +455,69 @@ describe "options: " do
276
455
  def app; SimpleApiWithHiddenPaths; end
277
456
 
278
457
  it "has no formats" do
279
- get '/swagger_doc/something'
280
- last_response.body.should == "{:apiVersion=>\"0.1\", :swaggerVersion=>\"1.1\", :basePath=>\"http://example.org\", :resourcePath=>\"\", :apis=>[{:path=>\"/something\", :operations=>[{:notes=>nil, :summary=>\"this gets something\", :nickname=>\"GET-something---format-\", :httpMethod=>\"GET\", :parameters=>[]}]}]}"
458
+ get '/swagger_doc/something.json'
459
+ JSON.parse(last_response.body)["apis"].each do |api|
460
+ api["path"].should_not end_with ".{format}"
461
+ end
462
+ end
463
+ end
464
+
465
+ context "multiple documentations" do
466
+ before :all do
467
+ class FirstApi < Grape::API
468
+ desc 'This is the first API'
469
+ get '/first' do
470
+ { first: 'hip' }
471
+ end
472
+
473
+ add_swagger_documentation mount_path: '/first/swagger_doc'
474
+ end
475
+
476
+ class SecondApi < Grape::API
477
+ desc 'This is the second API'
478
+ get '/second' do
479
+ { second: 'hop' }
480
+ end
481
+
482
+ add_swagger_documentation mount_path: '/second/swagger_doc'
483
+ end
484
+
485
+ class SimpleApiWithMultipleMountedDocumentations < Grape::API
486
+ mount FirstApi
487
+ mount SecondApi
488
+ end
489
+ end
490
+
491
+ def app; SimpleApiWithMultipleMountedDocumentations; end
492
+
493
+ it "retrieves the first swagger-documentation on /first/swagger_doc" do
494
+ get '/first/swagger_doc.json'
495
+ JSON.parse(last_response.body).should == {
496
+ "apiVersion" => "0.1",
497
+ "swaggerVersion" => "1.2",
498
+ "basePath" => "http://example.org",
499
+ "info" => {},
500
+ "produces" => ["application/xml", "application/json", "text/plain"],
501
+ "operations" => [],
502
+ "apis" => [
503
+ { "path" => "/first.{format}" }
504
+ ]
505
+ }
506
+ end
507
+
508
+ it "retrieves the first swagger-documentation on /second/swagger_doc" do
509
+ get '/second/swagger_doc.json'
510
+ JSON.parse(last_response.body).should == {
511
+ "apiVersion" => "0.1",
512
+ "swaggerVersion" => "1.2",
513
+ "basePath" => "http://example.org",
514
+ "info" => {},
515
+ "produces" => ["application/xml", "application/json", "text/plain"],
516
+ "operations" => [],
517
+ "apis" => [
518
+ { "path" => "/second.{format}" }
519
+ ]
520
+ }
281
521
  end
282
522
  end
283
523
  end