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

Commit d766965

Browse files
author
Brian Butz
committed
v3(services): Ensure that whole credential binding view is filtered on
Without .from_self, there WHERE clause is only applied to the first table in the view [#173148626](https://www.pivotaltracker.com/story/show/173148626)
1 parent 8ee41d4 commit d766965

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

app/models/services/service_credential_binding_view.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module Types
2525
SERVICE_BINDING_VIEW
2626
].inject do |statement, sub_select|
2727
statement.union(sub_select, all: true, from_self: false)
28-
end.freeze
28+
end.from_self.freeze
2929

3030
class View < Sequel::Model(VIEW)
3131
many_to_one :service_instance, class: 'VCAP::CloudController::ServiceInstance'

spec/unit/fetchers/service_credential_binding_fetcher_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ module CloudController
77
let(:fetcher) { ServiceCredentialBindingFetcher.new }
88

99
describe 'not a real guid' do
10+
let!(:existing_credential_binding) { ServiceBinding.make }
11+
1012
it 'should return nothing' do
1113
credential_binding = fetcher.fetch('does-not-exist')
1214
expect(credential_binding).to be_nil

0 commit comments

Comments
 (0)