grape-swagger 0.20.2 → 0.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -3
  3. data/.rubocop_todo.yml +43 -33
  4. data/.travis.yml +22 -13
  5. data/CHANGELOG.md +29 -53
  6. data/Gemfile +1 -1
  7. data/README.md +24 -24
  8. data/example/api/endpoints.rb +28 -29
  9. data/example/api/entities.rb +1 -1
  10. data/example/config.ru +5 -7
  11. data/grape-swagger.gemspec +1 -1
  12. data/lib/grape-swagger.rb +9 -6
  13. data/lib/grape-swagger/doc_methods.rb +1 -1
  14. data/lib/grape-swagger/doc_methods/extensions.rb +3 -3
  15. data/lib/grape-swagger/doc_methods/headers.rb +1 -1
  16. data/lib/grape-swagger/doc_methods/move_params.rb +25 -16
  17. data/lib/grape-swagger/doc_methods/operation_id.rb +2 -2
  18. data/lib/grape-swagger/doc_methods/parse_params.rb +12 -5
  19. data/lib/grape-swagger/doc_methods/path_string.rb +1 -1
  20. data/lib/grape-swagger/doc_methods/status_codes.rb +3 -1
  21. data/lib/grape-swagger/doc_methods/tag_name_description.rb +1 -1
  22. data/lib/grape-swagger/endpoint.rb +33 -46
  23. data/lib/grape-swagger/grape/route.rb +16 -0
  24. data/lib/grape-swagger/version.rb +1 -1
  25. data/spec/issues/403_versions_spec.rb +158 -0
  26. data/spec/lib/data_type_spec.rb +9 -10
  27. data/spec/lib/endpoint_spec.rb +1 -2
  28. data/spec/lib/extensions_spec.rb +44 -40
  29. data/spec/lib/move_params_spec.rb +113 -93
  30. data/spec/lib/operation_id_spec.rb +42 -12
  31. data/spec/lib/optional_object_spec.rb +3 -4
  32. data/spec/lib/path_string_spec.rb +2 -2
  33. data/spec/lib/produces_consumes_spec.rb +64 -53
  34. data/spec/markdown/redcarpet_adapter_spec.rb +1 -1
  35. data/spec/spec_helper.rb +1 -1
  36. data/spec/support/api_swagger_v2_result.rb +122 -128
  37. data/spec/support/namespace_tags.rb +17 -19
  38. data/spec/support/the_api_entities.rb +1 -3
  39. data/spec/support/the_paths_definitions.rb +95 -85
  40. data/spec/swagger_v2/api_swagger_v2_definitions-models_spec.rb +1 -1
  41. data/spec/swagger_v2/api_swagger_v2_detail_spec.rb +19 -19
  42. data/spec/swagger_v2/api_swagger_v2_extensions_spec.rb +21 -21
  43. data/spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb +34 -32
  44. data/spec/swagger_v2/api_swagger_v2_global_configuration_spec.rb +5 -7
  45. data/spec/swagger_v2/api_swagger_v2_headers_spec.rb +19 -18
  46. data/spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb +9 -10
  47. data/spec/swagger_v2/api_swagger_v2_mounted_spec.rb +21 -24
  48. data/spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb +90 -92
  49. data/spec/swagger_v2/api_swagger_v2_param_type_body_spec.rb +54 -54
  50. data/spec/swagger_v2/api_swagger_v2_param_type_spec.rb +65 -57
  51. data/spec/swagger_v2/api_swagger_v2_request_params_fix_spec.rb +17 -14
  52. data/spec/swagger_v2/api_swagger_v2_response_spec.rb +79 -123
  53. data/spec/swagger_v2/api_swagger_v2_spec.rb +33 -34
  54. data/spec/swagger_v2/api_swagger_v2_type-format_spec.rb +32 -36
  55. data/spec/swagger_v2/boolean_params_spec.rb +1 -1
  56. data/spec/swagger_v2/default_api_spec.rb +26 -29
  57. data/spec/swagger_v2/description_not_initialized.rb +3 -3
  58. data/spec/swagger_v2/float_api_spec.rb +1 -1
  59. data/spec/swagger_v2/form_params_spec.rb +4 -4
  60. data/spec/swagger_v2/hide_api_spec.rb +48 -51
  61. data/spec/swagger_v2/host.rb +1 -1
  62. data/spec/swagger_v2/mounted_target_class_spec.rb +31 -33
  63. data/spec/swagger_v2/namespace_tags_prefix_spec.rb +23 -21
  64. data/spec/swagger_v2/namespace_tags_spec.rb +23 -20
  65. data/spec/swagger_v2/param_type_spec.rb +5 -6
  66. data/spec/swagger_v2/param_values_spec.rb +31 -37
  67. data/spec/swagger_v2/params_array_spec.rb +17 -15
  68. data/spec/swagger_v2/params_hash_spec.rb +17 -15
  69. data/spec/swagger_v2/params_nested_spec.rb +12 -10
  70. data/spec/swagger_v2/reference_entity.rb +9 -9
  71. data/spec/swagger_v2/response_model_spec.rb +58 -62
  72. data/spec/swagger_v2/simple_mounted_api_spec.rb +179 -147
  73. metadata +5 -10
  74. data/spec/params_entity_spec.rb +0 -49
@@ -24,7 +24,7 @@ describe 'Boolean Params' do
24
24
 
25
25
  it 'converts boolean types' do
26
26
  expect(subject).to eq [
27
- {"in"=>"formData", "name"=>"a_boolean", "description"=>nil, "type"=>"boolean", "required"=>true}
27
+ { 'in' => 'formData', 'name' => 'a_boolean', 'type' => 'boolean', 'required' => true }
28
28
  ]
29
29
  end
30
30
  end
@@ -21,20 +21,19 @@ describe 'Default API' do
21
21
 
22
22
  it 'documents api' do
23
23
  expect(subject).to eq(
24
- {
25
- "info"=>{"title"=>"API title", "version"=>"v1"},
26
- "swagger"=>"2.0",
27
- "produces"=>["application/json"],
28
- "host"=>"example.org",
29
- "tags" => [{"name"=>"something", "description"=>"Operations about somethings"}],
30
- "paths"=>{
31
- "/something"=>{
32
- "get"=>{
33
- "description"=>"This gets something.",
34
- "produces"=>["application/json"],
35
- "tags"=>["something"],
36
- "operationId"=>"getSomething",
37
- "responses"=>{"200"=>{"description"=>"This gets something."}}}}}}
24
+ 'info' => { 'title' => 'API title', 'version' => '0.0.1' },
25
+ 'swagger' => '2.0',
26
+ 'produces' => ['application/json'],
27
+ 'host' => 'example.org',
28
+ 'tags' => [{ 'name' => 'something', 'description' => 'Operations about somethings' }],
29
+ 'paths' => {
30
+ '/something' => {
31
+ 'get' => {
32
+ 'description' => 'This gets something.',
33
+ 'produces' => ['application/json'],
34
+ 'tags' => ['something'],
35
+ 'operationId' => 'getSomething',
36
+ 'responses' => { '200' => { 'description' => 'This gets something.' } } } } }
38
37
  )
39
38
  end
40
39
 
@@ -65,21 +64,19 @@ describe 'Default API' do
65
64
  end
66
65
 
67
66
  it 'documents endpoint' do
68
- expect(subject).to eq({
69
- "info"=>{"title"=>"API title", "version"=>"v1"},
70
- "swagger"=>"2.0",
71
- "produces"=>["application/json"],
72
- "host"=>"example.org",
73
- "tags" => [{"name"=>"something", "description"=>"Operations about somethings"}],
74
- "paths"=>{
75
- "/something"=>{
76
- "get"=>{
77
- "description"=>"This gets something.",
78
- "produces"=>["application/json"],
79
- "tags"=>["something"],
80
- "operationId"=>"getSomething",
81
- "responses"=>{"200"=>{"description"=>"This gets something."}}}}}
82
- })
67
+ expect(subject).to eq('info' => { 'title' => 'API title', 'version' => '0.0.1' },
68
+ 'swagger' => '2.0',
69
+ 'produces' => ['application/json'],
70
+ 'host' => 'example.org',
71
+ 'tags' => [{ 'name' => 'something', 'description' => 'Operations about somethings' }],
72
+ 'paths' => {
73
+ '/something' => {
74
+ 'get' => {
75
+ 'description' => 'This gets something.',
76
+ 'produces' => ['application/json'],
77
+ 'tags' => ['something'],
78
+ 'operationId' => 'getSomething',
79
+ 'responses' => { '200' => { 'description' => 'This gets something.' } } } } })
83
80
  end
84
81
  end
85
82
 
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe 'details' do
4
4
  describe 'details, pass markdown with redcarpet even with nil description and detail', unless: RUBY_PLATFORM.eql?('java') do
5
- include_context "the api entities"
5
+ include_context 'the api entities'
6
6
 
7
7
  before :all do
8
8
  module TheApi
@@ -12,9 +12,9 @@ describe 'details' do
12
12
  desc nil,
13
13
  detail: nil,
14
14
  entity: Entities::UseResponse,
15
- failure: [{code: 400, model: Entities::ApiError}]
15
+ failure: [{ code: 400, model: Entities::ApiError }]
16
16
  get '/use_gfm_rc_detail' do
17
- { "declared_params" => declared(params) }
17
+ { 'declared_params' => declared(params) }
18
18
  end
19
19
 
20
20
  add_swagger_documentation markdown: GrapeSwagger::Markdown::RedcarpetAdapter.new
@@ -24,7 +24,7 @@ describe 'Float Params' do
24
24
 
25
25
  it 'converts float types' do
26
26
  expect(subject).to eq [
27
- {"in"=>"formData", "name"=>"a_float", "description"=>nil, "type"=>"number", "required"=>true, "format"=>"float"}
27
+ { 'in' => 'formData', 'name' => 'a_float', 'type' => 'number', 'required' => true, 'format' => 'float' }
28
28
  ]
29
29
  end
30
30
  end
@@ -50,16 +50,16 @@ describe 'Form Params' do
50
50
 
51
51
  it 'retrieves the documentation form params' do
52
52
  expect(subject['paths'].length).to eq 2
53
- expect(subject['paths'].keys).to include('/items','/items/{id}')
53
+ expect(subject['paths'].keys).to include('/items', '/items/{id}')
54
54
  expect(subject['paths']['/items'].keys).to include 'post'
55
55
  expect(subject['paths']['/items/{id}'].keys).to include('post', 'patch', 'put')
56
56
  end
57
57
 
58
58
  it 'treats Symbol parameter as form param' do
59
59
  expect(subject['paths']['/items/{id}']['post']['parameters']).to eq [
60
- {"in"=>"path", "name"=>"id", "description"=>"id of item", "type"=>"integer", "required"=>true, "format"=>"int32"},
61
- {"in"=>"formData", "name"=>"name", "description"=>"name of item", "type"=>"string", "required"=>true},
62
- {"in"=>"formData", "name"=>"conditions", "description"=>"conditions of item", "type"=>"string", "required"=>false, "enum"=>["one", "two"]}
60
+ { 'in' => 'path', 'name' => 'id', 'description' => 'id of item', 'type' => 'integer', 'required' => true, 'format' => 'int32' },
61
+ { 'in' => 'formData', 'name' => 'name', 'description' => 'name of item', 'type' => 'string', 'required' => true },
62
+ { 'in' => 'formData', 'name' => 'conditions', 'description' => 'conditions of item', 'type' => 'string', 'required' => false, 'enum' => %w(one two) }
63
63
  ]
64
64
  end
65
65
  end
@@ -35,28 +35,27 @@ describe 'a hide mounted api' do
35
35
  end
36
36
 
37
37
  it "retrieves swagger-documentation that doesn't include hidden endpoints" do
38
- expect(subject).to eq({
39
- "info"=>{"title"=>"API title", "version"=>"v1"},
40
- "swagger"=>"2.0",
41
- "produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
42
- "host"=>"example.org",
43
- "tags" => [{"name"=>"simple", "description"=>"Operations about simples"}, {"name"=>"lazy", "description"=>"Operations about lazies"}],
44
- "paths"=>{
45
- "/simple"=>{
46
- "get"=>{
47
- "description"=>"Show this endpoint",
48
- "produces"=>["application/json"],
49
- "tags"=>["simple"],
50
- "operationId"=>"getSimple",
51
- "responses"=>{"200"=>{"description"=>"Show this endpoint"}}}},
52
- "/lazy"=>{
53
- "get"=>{
54
- "description"=>"Lazily show endpoint",
55
- "produces"=>["application/json"],
56
- "tags"=>["lazy"],
57
- "operationId"=>"getLazy",
58
- "responses"=>{"200"=>{"description"=>"Lazily show endpoint"}}}}}
59
- })
38
+ expect(subject).to eq(
39
+ 'info' => { 'title' => 'API title', 'version' => '0.0.1' },
40
+ 'swagger' => '2.0',
41
+ 'produces' => ['application/xml', 'application/json', 'application/octet-stream', 'text/plain'],
42
+ 'host' => 'example.org',
43
+ 'tags' => [{ 'name' => 'simple', 'description' => 'Operations about simples' }, { 'name' => 'lazy', 'description' => 'Operations about lazies' }],
44
+ 'paths' => {
45
+ '/simple' => {
46
+ 'get' => {
47
+ 'description' => 'Show this endpoint',
48
+ 'produces' => ['application/json'],
49
+ 'tags' => ['simple'],
50
+ 'operationId' => 'getSimple',
51
+ 'responses' => { '200' => { 'description' => 'Show this endpoint' } } } },
52
+ '/lazy' => {
53
+ 'get' => {
54
+ 'description' => 'Lazily show endpoint',
55
+ 'produces' => ['application/json'],
56
+ 'tags' => ['lazy'],
57
+ 'operationId' => 'getLazy',
58
+ 'responses' => { '200' => { 'description' => 'Lazily show endpoint' } } } } })
60
59
  end
61
60
  end
62
61
 
@@ -91,38 +90,36 @@ describe 'a hide mounted api with same namespace' do
91
90
 
92
91
  it 'retrieves swagger-documentation on /swagger_doc' do
93
92
  get '/swagger_doc.json'
94
- expect(JSON.parse(last_response.body)).to eq({
95
- "info"=>{"title"=>"API title", "version"=>"v1"},
96
- "swagger"=>"2.0",
97
- "produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
98
- "host"=>"example.org",
99
- "tags" => [{"name"=>"simple", "description"=>"Operations about simples"}],
100
- "paths"=>{
101
- "/simple/show"=>{
102
- "get"=>{
103
- "description"=>"Show this endpoint",
104
- "produces"=>["application/json"],
105
- "operationId"=>"getSimpleShow",
106
- "tags"=>["simple"], "responses"=>{"200"=>{"description"=>"Show this endpoint"}}}}}
107
- })
93
+ expect(JSON.parse(last_response.body)).to eq(
94
+ 'info' => { 'title' => 'API title', 'version' => '0.0.1' },
95
+ 'swagger' => '2.0',
96
+ 'produces' => ['application/xml', 'application/json', 'application/octet-stream', 'text/plain'],
97
+ 'host' => 'example.org',
98
+ 'tags' => [{ 'name' => 'simple', 'description' => 'Operations about simples' }],
99
+ 'paths' => {
100
+ '/simple/show' => {
101
+ 'get' => {
102
+ 'description' => 'Show this endpoint',
103
+ 'produces' => ['application/json'],
104
+ 'operationId' => 'getSimpleShow',
105
+ 'tags' => ['simple'], 'responses' => { '200' => { 'description' => 'Show this endpoint' } } } } })
108
106
  end
109
107
 
110
108
  it "retrieves the documentation for mounted-api that doesn't include hidden endpoints" do
111
109
  get '/swagger_doc/simple.json'
112
- expect(JSON.parse(last_response.body)).to eq({
113
- "info"=>{"title"=>"API title", "version"=>"v1"},
114
- "swagger"=>"2.0",
115
- "produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
116
- "host"=>"example.org",
117
- "tags" => [{"name"=>"simple", "description"=>"Operations about simples"}],
118
- "paths"=>{
119
- "/simple/show"=>{
120
- "get"=>{
121
- "description"=>"Show this endpoint",
122
- "produces"=>["application/json"],
123
- "tags"=>["simple"],
124
- "operationId"=>"getSimpleShow",
125
- "responses"=>{"200"=>{"description"=>"Show this endpoint"}}}}}
126
- })
110
+ expect(JSON.parse(last_response.body)).to eq(
111
+ 'info' => { 'title' => 'API title', 'version' => '0.0.1' },
112
+ 'swagger' => '2.0',
113
+ 'produces' => ['application/xml', 'application/json', 'application/octet-stream', 'text/plain'],
114
+ 'host' => 'example.org',
115
+ 'tags' => [{ 'name' => 'simple', 'description' => 'Operations about simples' }],
116
+ 'paths' => {
117
+ '/simple/show' => {
118
+ 'get' => {
119
+ 'description' => 'Show this endpoint',
120
+ 'produces' => ['application/json'],
121
+ 'tags' => ['simple'],
122
+ 'operationId' => 'getSimpleShow',
123
+ 'responses' => { '200' => { 'description' => 'Show this endpoint' } } } } })
127
124
  end
128
125
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'host in the swagger_doc' do
4
- include_context "the api entities"
4
+ include_context 'the api entities'
5
5
 
6
6
  before :all do
7
7
  module TheApi
@@ -28,47 +28,45 @@ describe 'docs mounted separately from api' do
28
28
 
29
29
  it 'retrieves docs for actual api class' do
30
30
  get '/swagger_doc.json'
31
- expect(JSON.parse(last_response.body)).to eq({
32
- "info"=>{"title"=>"API title", "version"=>"v1"},
33
- "swagger"=>"2.0",
34
- "produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
35
- "host"=>"example.org",
36
- "tags"=>[{"name"=>"simple", "description"=>"Operations about simples"}],
37
- "paths"=>{
38
- "/simple"=>{
39
- "get"=>{
40
- "description"=>"This gets something.",
41
- "produces"=>["application/json"],
42
- "responses"=>{"200"=>{"description"=>"This gets something."}},
43
- "tags"=>["simple"],
44
- "operationId"=>"getSimple"
31
+ expect(JSON.parse(last_response.body)).to eq(
32
+ 'info' => { 'title' => 'API title', 'version' => '0.0.1' },
33
+ 'swagger' => '2.0',
34
+ 'produces' => ['application/xml', 'application/json', 'application/octet-stream', 'text/plain'],
35
+ 'host' => 'example.org',
36
+ 'tags' => [{ 'name' => 'simple', 'description' => 'Operations about simples' }],
37
+ 'paths' => {
38
+ '/simple' => {
39
+ 'get' => {
40
+ 'description' => 'This gets something.',
41
+ 'produces' => ['application/json'],
42
+ 'responses' => { '200' => { 'description' => 'This gets something.' } },
43
+ 'tags' => ['simple'],
44
+ 'operationId' => 'getSimple'
45
45
  }
46
46
  }
47
- }
48
- })
47
+ })
49
48
  end
50
49
 
51
50
  it 'retrieves docs for endpoint in actual api class' do
52
51
  get '/swagger_doc/simple.json'
53
- expect(JSON.parse(last_response.body)).to eq({
54
- "info"=>{"title"=>"API title", "version"=>"v1"},
55
- "swagger"=>"2.0",
56
- "tags" => [{"name"=>"simple", "description"=>"Operations about simples"}],
57
- "produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
58
- "host"=>"example.org",
59
- "paths" => {
60
- "/simple"=>{
61
- "get"=>{
62
- "description"=>"This gets something.",
63
- "produces"=>["application/json"],
64
- "responses"=>{
65
- "200"=>{"description"=>"This gets something."}
52
+ expect(JSON.parse(last_response.body)).to eq(
53
+ 'info' => { 'title' => 'API title', 'version' => '0.0.1' },
54
+ 'swagger' => '2.0',
55
+ 'tags' => [{ 'name' => 'simple', 'description' => 'Operations about simples' }],
56
+ 'produces' => ['application/xml', 'application/json', 'application/octet-stream', 'text/plain'],
57
+ 'host' => 'example.org',
58
+ 'paths' => {
59
+ '/simple' => {
60
+ 'get' => {
61
+ 'description' => 'This gets something.',
62
+ 'produces' => ['application/json'],
63
+ 'responses' => {
64
+ '200' => { 'description' => 'This gets something.' }
66
65
  },
67
- "tags"=>["simple"],
68
- "operationId"=>"getSimple"
66
+ 'tags' => ['simple'],
67
+ 'operationId' => 'getSimple'
69
68
  }
70
69
  }
71
- }
72
- })
70
+ })
73
71
  end
74
72
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'namespace tags check while using prefix and version' do
4
- include_context "namespace example"
4
+ include_context 'namespace example'
5
5
 
6
6
  before :all do
7
7
  module TheApi
@@ -21,19 +21,20 @@ describe 'namespace tags check while using prefix and version' do
21
21
  TagApi
22
22
  end
23
23
 
24
- describe "retrieves swagger-documentation on /swagger_doc" do
24
+ describe 'retrieves swagger-documentation on /swagger_doc' do
25
25
  subject do
26
26
  get '/api/swagger_doc.json'
27
27
  JSON.parse(last_response.body)
28
28
  end
29
29
 
30
30
  specify do
31
- expect(subject['tags']).to eql([
32
- {"name"=>"hudson", "description"=>"Operations about hudsons"},
33
- {"name"=>"colorado", "description"=>"Operations about colorados"},
34
- {"name"=>"thames", "description"=>"Operations about thames"},
35
- {"name"=>"niles", "description"=>"Operations about niles"}
36
- ])
31
+ expect(subject['tags']).to eql(
32
+ [
33
+ { 'name' => 'hudson', 'description' => 'Operations about hudsons' },
34
+ { 'name' => 'colorado', 'description' => 'Operations about colorados' },
35
+ { 'name' => 'thames', 'description' => 'Operations about thames' },
36
+ { 'name' => 'niles', 'description' => 'Operations about niles' }
37
+ ])
37
38
 
38
39
  expect(subject['paths']['/api/v1/hudson']['get']['tags']).to eql(['hudson'])
39
40
  expect(subject['paths']['/api/v1/colorado/simple']['get']['tags']).to eql(['colorado'])
@@ -44,7 +45,6 @@ describe 'namespace tags check while using prefix and version' do
44
45
  end
45
46
  end
46
47
 
47
-
48
48
  describe 'retrieves the documentation for mounted-api' do
49
49
  subject do
50
50
  get '/api/swagger_doc/colorado.json'
@@ -52,12 +52,13 @@ describe 'namespace tags check while using prefix and version' do
52
52
  end
53
53
 
54
54
  specify do
55
- expect(subject['tags']).to eql([
56
- {"name"=>"hudson", "description"=>"Operations about hudsons"},
57
- {"name"=>"colorado", "description"=>"Operations about colorados"},
58
- {"name"=>"thames", "description"=>"Operations about thames"},
59
- {"name"=>"niles", "description"=>"Operations about niles"}
60
- ])
55
+ expect(subject['tags']).to eql(
56
+ [
57
+ { 'name' => 'hudson', 'description' => 'Operations about hudsons' },
58
+ { 'name' => 'colorado', 'description' => 'Operations about colorados' },
59
+ { 'name' => 'thames', 'description' => 'Operations about thames' },
60
+ { 'name' => 'niles', 'description' => 'Operations about niles' }
61
+ ])
61
62
 
62
63
  expect(subject['paths']['/api/v1/colorado/simple']['get']['tags']).to eql(['colorado'])
63
64
  expect(subject['paths']['/api/v1/colorado/simple-test']['get']['tags']).to eql(['colorado'])
@@ -70,12 +71,13 @@ describe 'namespace tags check while using prefix and version' do
70
71
  end
71
72
 
72
73
  specify do
73
- expect(subject['tags']).to eql([
74
- {"name"=>"hudson", "description"=>"Operations about hudsons"},
75
- {"name"=>"colorado", "description"=>"Operations about colorados"},
76
- {"name"=>"thames", "description"=>"Operations about thames"},
77
- {"name"=>"niles", "description"=>"Operations about niles"}
78
- ])
74
+ expect(subject['tags']).to eql(
75
+ [
76
+ { 'name' => 'hudson', 'description' => 'Operations about hudsons' },
77
+ { 'name' => 'colorado', 'description' => 'Operations about colorados' },
78
+ { 'name' => 'thames', 'description' => 'Operations about thames' },
79
+ { 'name' => 'niles', 'description' => 'Operations about niles' }
80
+ ])
79
81
 
80
82
  expect(subject['paths']['/api/v1/thames/simple_with_headers']['get']['tags']).to eql(['thames'])
81
83
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'namespace tags check' do
4
- include_context "namespace example"
4
+ include_context 'namespace example'
5
5
 
6
6
  before :all do
7
7
  class TestApi < Grape::API
@@ -14,19 +14,20 @@ describe 'namespace tags check' do
14
14
  TestApi
15
15
  end
16
16
 
17
- describe "retrieves swagger-documentation on /swagger_doc" do
17
+ describe 'retrieves swagger-documentation on /swagger_doc' do
18
18
  subject do
19
19
  get '/swagger_doc.json'
20
20
  JSON.parse(last_response.body)
21
21
  end
22
22
 
23
23
  specify do
24
- expect(subject['tags']).to eql([
25
- {"name"=>"hudson", "description"=>"Operations about hudsons"},
26
- {"name"=>"colorado", "description"=>"Operations about colorados"},
27
- {"name"=>"thames", "description"=>"Operations about thames"},
28
- {"name"=>"niles", "description"=>"Operations about niles"}
29
- ])
24
+ expect(subject['tags']).to eql(
25
+ [
26
+ { 'name' => 'hudson', 'description' => 'Operations about hudsons' },
27
+ { 'name' => 'colorado', 'description' => 'Operations about colorados' },
28
+ { 'name' => 'thames', 'description' => 'Operations about thames' },
29
+ { 'name' => 'niles', 'description' => 'Operations about niles' }
30
+ ])
30
31
 
31
32
  expect(subject['paths']['/hudson']['get']['tags']).to eql(['hudson'])
32
33
  expect(subject['paths']['/colorado/simple']['get']['tags']).to eql(['colorado'])
@@ -44,12 +45,13 @@ describe 'namespace tags check' do
44
45
  end
45
46
 
46
47
  specify do
47
- expect(subject['tags']).to eql([
48
- {"name"=>"hudson", "description"=>"Operations about hudsons"},
49
- {"name"=>"colorado", "description"=>"Operations about colorados"},
50
- {"name"=>"thames", "description"=>"Operations about thames"},
51
- {"name"=>"niles", "description"=>"Operations about niles"}
52
- ])
48
+ expect(subject['tags']).to eql(
49
+ [
50
+ { 'name' => 'hudson', 'description' => 'Operations about hudsons' },
51
+ { 'name' => 'colorado', 'description' => 'Operations about colorados' },
52
+ { 'name' => 'thames', 'description' => 'Operations about thames' },
53
+ { 'name' => 'niles', 'description' => 'Operations about niles' }
54
+ ])
53
55
 
54
56
  expect(subject['paths']['/colorado/simple']['get']['tags']).to eql(['colorado'])
55
57
  expect(subject['paths']['/colorado/simple-test']['get']['tags']).to eql(['colorado'])
@@ -62,12 +64,13 @@ describe 'namespace tags check' do
62
64
  end
63
65
 
64
66
  specify do
65
- expect(subject['tags']).to eql([
66
- {"name"=>"hudson", "description"=>"Operations about hudsons"},
67
- {"name"=>"colorado", "description"=>"Operations about colorados"},
68
- {"name"=>"thames", "description"=>"Operations about thames"},
69
- {"name"=>"niles", "description"=>"Operations about niles"}
70
- ])
67
+ expect(subject['tags']).to eql(
68
+ [
69
+ { 'name' => 'hudson', 'description' => 'Operations about hudsons' },
70
+ { 'name' => 'colorado', 'description' => 'Operations about colorados' },
71
+ { 'name' => 'thames', 'description' => 'Operations about thames' },
72
+ { 'name' => 'niles', 'description' => 'Operations about niles' }
73
+ ])
71
74
 
72
75
  expect(subject['paths']['/thames/simple_with_headers']['get']['tags']).to eql(['thames'])
73
76
  end