Skip to content

Commit

Permalink
Bump rubocop to 0.47.1 again
Browse files Browse the repository at this point in the history
- Include dependencies this time

[#145974963]
  • Loading branch information
Gerg committed May 27, 2017
1 parent 62ad538 commit 6355836
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 31 deletions.
11 changes: 6 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ GEM
parallel (1.10.0)
parallel_tests (2.13.0)
parallel
parser (2.3.3.1)
parser (2.4.0.0)
ast (~> 2.2)
pg (0.19.0)
posix-spawn (0.3.11)
Expand Down Expand Up @@ -297,7 +297,8 @@ GEM
activesupport (= 4.2.7.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.1.0)
rainbow (2.2.2)
rake
rake (11.3.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
Expand Down Expand Up @@ -335,8 +336,8 @@ GEM
rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
rubocop (0.46.0)
parser (>= 2.3.1.1, < 3.0)
rubocop (0.47.1)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
Expand Down Expand Up @@ -389,7 +390,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
unicode-display_width (1.1.2)
unicode-display_width (1.2.1)
uuidtools (2.1.5)
vcap_common (4.0.4)
addressable (~> 2.2)
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/api/job_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def status_url
end

def error_details
YAML.load(@object.cf_api_error)
YAML.safe_load(@object.cf_api_error, [Symbol])
end

def job_exception_or_nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ def initialize(uri, method, response, ignore_description_key: false)
rescue MultiJson::ParseError
end

if hash.is_a?(Hash) && hash.key?('description') && !ignore_description_key
message = "Service broker error: #{hash['description']}"
else
message = "The service broker returned an invalid response for the request to #{uri}. " \
"Status Code: #{response.code} #{response.message}, Body: #{response.body}"
end
message = if hash.is_a?(Hash) && hash.key?('description') && !ignore_description_key
"Service broker error: #{hash['description']}"
else
"The service broker returned an invalid response for the request to #{uri}. " \
"Status Code: #{response.code} #{response.message}, Body: #{response.body}"
end

super(message, uri, method, response)
end
Expand Down
38 changes: 19 additions & 19 deletions lib/services/service_brokers/v2/response_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -367,25 +367,25 @@ def validate(method:, uri:, code:, response:)

class SuccessValidator
def initialize(state: nil, &block)
if block_given?
@processor = block
else
@processor = ->(response) do
broker_response = MultiJson.load(response.body)
state ||= broker_response.delete('state')
return broker_response unless state

base_body = {
'last_operation' => {
'state' => state
}
}
description = broker_response.delete('description')
base_body['last_operation']['description'] = description if description

broker_response.merge(base_body)
end
end
@processor = if block_given?
block
else
->(response) do
broker_response = MultiJson.load(response.body)
state ||= broker_response.delete('state')
return broker_response unless state

base_body = {
'last_operation' => {
'state' => state
}
}
description = broker_response.delete('description')
base_body['last_operation']['description'] = description if description

broker_response.merge(base_body)
end
end
end

def validate(method:, uri:, code:, response:)
Expand Down

0 comments on commit 6355836

Please sign in to comment.