Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 93ced51

Browse files
author
Brian Butz
committed
v3(services): read service documentationUrl correctly
Brokers return 'documentationUrl' rather than 'documentation_url' in metadata [#173447953](https://www.pivotaltracker.com/story/show/173447953)
1 parent 07b60b1 commit 93ced51

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

app/decorators/field_service_instance_offering_decorator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def decorate(hash, service_instances)
4646

4747
def extract_documentation_url(extra)
4848
metadata = JSON.parse(extra)
49-
metadata['documentation_url']
49+
metadata['documentationUrl']
5050
rescue JSON::ParserError
5151
nil
5252
end

app/presenters/v3/service_offering_presenter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def shareable(metadata)
5858
end
5959

6060
def documentation_url(metadata)
61-
metadata['documentation_url'] || ''
61+
metadata['documentationUrl'] || ''
6262
end
6363

6464
def broker_metadata

spec/support/fakes/blueprints.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ module VCAP::CloudController
305305
active { true }
306306
service_broker { ServiceBroker.make }
307307
description { Sham.description } # remove hack
308-
extra { '{"shareable": true, "documentation_url": "https://some.url.for.docs/"}' }
308+
extra { '{"shareable": true, "documentationUrl": "https://some.url.for.docs/"}' }
309309
instances_retrievable { false }
310310
bindings_retrievable { false }
311311
plan_updateable { false }

spec/unit/decorators/field_service_instance_offering_decorator_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
module VCAP::CloudController
55
RSpec.describe FieldServiceInstanceOfferingDecorator do
66
describe '.decorate' do
7-
let(:offering1) { Service.make(extra: '{"documentation_url": "https://offering1.com"}') }
8-
let(:offering2) { Service.make(extra: '{"documentation_url": "https://offering2.com"}') }
7+
let(:offering1) { Service.make(extra: '{"documentationUrl": "https://offering1.com"}') }
8+
let(:offering2) { Service.make(extra: '{"documentationUrl": "https://offering2.com"}') }
99

1010
let(:plan1) { ServicePlan.make(service: offering1) }
1111
let(:plan2) { ServicePlan.make(service: offering2) }

spec/unit/presenters/v3/service_offering_presenter_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
end
192192

193193
context 'when `documentation_url` is set' do
194-
let(:extra) { '{"documentation_url": "https://some.documentation.url/"}' }
194+
let(:extra) { '{"documentationUrl": "https://some.documentation.url/"}' }
195195

196196
it 'displays the value` as a top level field' do
197197
expect(result[:documentation_url]).to eq 'https://some.documentation.url/'

0 commit comments

Comments
 (0)