Skip to content

Commit aa86b57

Browse files
committed
Fix many specs
1 parent e4591d3 commit aa86b57

File tree

4 files changed

+49
-35
lines changed

4 files changed

+49
-35
lines changed

.rubocop_todo.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,50 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2016-05-11 07:25:12 +0300 using RuboCop version 0.39.0.
3+
# on 2017-11-19 22:40:01 +0200 using RuboCop version 0.51.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

99
# Offense count: 2
1010
Metrics/AbcSize:
11-
Max: 30
11+
Max: 34
12+
13+
# Offense count: 8
14+
# Configuration parameters: CountComments, ExcludedMethods.
15+
Metrics/BlockLength:
16+
Max: 132
1217

1318
# Offense count: 2
1419
Metrics/CyclomaticComplexity:
15-
Max: 11
20+
Max: 15
1621

17-
# Offense count: 65
18-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
22+
# Offense count: 67
23+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
1924
# URISchemes: http, https
2025
Metrics/LineLength:
21-
Max: 152
26+
Max: 160
2227

2328
# Offense count: 2
2429
# Configuration parameters: CountComments.
2530
Metrics/MethodLength:
2631
Max: 36
2732

33+
# Offense count: 1
34+
# Configuration parameters: CountKeywordArgs.
35+
Metrics/ParameterLists:
36+
Max: 6
37+
2838
# Offense count: 2
2939
Metrics/PerceivedComplexity:
30-
Max: 14
40+
Max: 18
41+
42+
# Offense count: 1
43+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
44+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
45+
Naming/FileName:
46+
Exclude:
47+
- 'lib/grape-swagger-representable.rb'
3148

3249
# Offense count: 2
3350
Style/Documentation:
@@ -36,9 +53,3 @@ Style/Documentation:
3653
- 'test/**/*'
3754
- 'lib/grape-swagger/representable.rb'
3855
- 'lib/grape-swagger/representable/parser.rb'
39-
40-
# Offense count: 1
41-
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
42-
Style/FileName:
43-
Exclude:
44-
- 'lib/grape-swagger-representable.rb'

grape-swagger-representable.gemspec

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# coding: utf-8
1+
22
lib = File.expand_path('../lib', __FILE__)
33
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
44
require 'grape-swagger/representable/version'
@@ -22,13 +22,14 @@ Gem::Specification.new do |s|
2222
s.add_runtime_dependency 'representable'
2323

2424
s.add_development_dependency 'bundler', '~> 1.12'
25-
s.add_development_dependency 'rake', '~> 10.0'
26-
s.add_development_dependency 'rspec', '~> 3.0'
27-
s.add_development_dependency 'rack-test'
25+
s.add_development_dependency 'multi_json'
26+
s.add_development_dependency 'pry' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx')
27+
s.add_development_dependency 'pry-byebug' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx')
2828
s.add_development_dependency 'rack-cors'
29-
s.add_development_dependency 'rubocop'
29+
s.add_development_dependency 'rack-test'
30+
s.add_development_dependency 'rake', '~> 10.0'
3031
s.add_development_dependency 'redcarpet' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx')
3132
s.add_development_dependency 'rouge' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx')
32-
s.add_development_dependency 'pry' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx')
33-
s.add_development_dependency 'pry-byebug' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx')
33+
s.add_development_dependency 'rspec', '~> 3.0'
34+
s.add_development_dependency 'rubocop'
3435
end

spec/grape-swagger/representers/response_inline_representer_spec.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ResponseModelApi < Grape::API
4949
end
5050

5151
# something like an index action
52-
desc 'This returns something or an error',
52+
desc 'This returns something',
5353
entity: Representers::Something,
5454
http_codes: [
5555
{ code: 200, message: 'OK', model: Representers::Something },
@@ -88,7 +88,8 @@ def app
8888
'description' => 'OK',
8989
'schema' => {
9090
'type' => 'array',
91-
'items' => { '$ref' => '#/definitions/Something' } }
91+
'items' => { '$ref' => '#/definitions/Something' }
92+
}
9293
}
9394
)
9495
end
@@ -107,7 +108,7 @@ def app
107108
expect(subject['definitions'].keys).to include 'Error'
108109
expect(subject['definitions']['Error']).to eq(
109110
'type' => 'object',
110-
'description' => 'This returns something or an error',
111+
'description' => 'This returns something',
111112
'properties' => {
112113
'code' => { 'type' => 'string', 'description' => 'Error code' },
113114
'message' => { 'type' => 'string', 'description' => 'Error message' }
@@ -117,16 +118,18 @@ def app
117118
expect(subject['definitions'].keys).to include 'Something'
118119
expect(subject['definitions']['Something']).to eq(
119120
'type' => 'object',
120-
'description' => 'This returns something or an error',
121+
'description' => 'This returns something',
121122
'properties' => {
122123
'text' => { 'description' => 'Content of something.', 'type' => 'string' },
123124
'kind' => { '$ref' => '#/definitions/Kind', 'description' => 'The kind of this something.' },
124125
'kind2' => {
125126
'type' => 'object',
126127
'properties' => {
127128
'id' => { 'description' => 'Title of the kind.', 'type' => 'integer', 'format' => 'int32' },
128-
'name' => { 'description' => 'Kind name.', 'type' => 'string' } },
129-
'description' => 'Secondary kind.' },
129+
'name' => { 'description' => 'Kind name.', 'type' => 'string' }
130+
},
131+
'description' => 'Secondary kind.'
132+
},
130133
'kind3' => { '$ref' => '#/definitions/Kind', 'description' => 'Tertiary kind.' },
131134
'tags' => {
132135
'type' => 'array',

spec/grape-swagger/representers/response_representer_spec.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ResponseModelApi < Grape::API
5252
end
5353

5454
# something like an index action
55-
desc 'This returns something or an error',
55+
desc 'This returns something',
5656
entity: Representers::Something,
5757
http_codes: [
5858
{ code: 200, message: 'OK', model: Representers::Something },
@@ -91,7 +91,8 @@ def app
9191
'description' => 'OK',
9292
'schema' => {
9393
'type' => 'array',
94-
'items' => { '$ref' => '#/definitions/Something' } }
94+
'items' => { '$ref' => '#/definitions/Something' }
95+
}
9596
}
9697
)
9798
end
@@ -110,17 +111,14 @@ def app
110111
expect(subject['definitions'].keys).to include 'Error'
111112
expect(subject['definitions']['Error']).to eq(
112113
'type' => 'object',
113-
'description' => 'This returns something or an error',
114-
'properties' => {
115-
'code' => { 'type' => 'string', 'description' => 'Error code' },
116-
'message' => { 'type' => 'string', 'description' => 'Error message' }
117-
}
114+
'description' => 'This returns something',
115+
'properties' => { 'code' => { 'description' => 'Error code', 'type' => 'string' }, 'message' => { 'description' => 'Error message', 'type' => 'string' } }
118116
)
119117

120118
expect(subject['definitions'].keys).to include 'Something'
121119
expect(subject['definitions']['Something']).to eq(
122120
'type' => 'object',
123-
'description' => 'This returns something or an error',
121+
'description' => 'This returns something',
124122
'properties' =>
125123
{ 'text' => { 'type' => 'string', 'description' => 'Content of something.' },
126124
'kind' => { '$ref' => '#/definitions/Kind', 'description' => 'The kind of this something.' },
@@ -221,6 +219,7 @@ def app
221219
'relation' => { '$ref' => '#/definitions/Relation', 'description' => 'A related model.' }
222220
},
223221
'description' => 'This returns something'
224-
})
222+
}
223+
)
225224
end
226225
end

0 commit comments

Comments
 (0)