Skip to content

Commit

Permalink
Add presenter for file-based-service-bindings app feature
Browse files Browse the repository at this point in the history
  • Loading branch information
philippthun committed Sep 27, 2024
1 parent f2e96d9 commit 5b0b183
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'presenters/v3/base_presenter'

module VCAP::CloudController::Presenters::V3
class AppFileBasedServiceBindingsFeaturePresenter < BasePresenter
def to_hash
{
name: 'file-based-service-bindings',
description: 'Enable file-based service bindings for the app',
enabled: app.file_based_service_bindings_enabled
}
end

private

def app
@resource
end
end
end
14 changes: 14 additions & 0 deletions spec/unit/presenters/v3/app_feature_presenter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'spec_helper'
require 'presenters/v3/app_ssh_feature_presenter'
require 'presenters/v3/app_file_based_service_bindings_feature_presenter'

module VCAP::CloudController::Presenters::V3
RSpec.describe AppSshFeaturePresenter do
Expand All @@ -14,4 +15,17 @@ module VCAP::CloudController::Presenters::V3
end
end
end

RSpec.describe AppFileBasedServiceBindingsFeaturePresenter do
let(:app) { VCAP::CloudController::AppModel.make }

describe '#to_hash' do
it 'presents the app feature as json' do
result = AppFileBasedServiceBindingsFeaturePresenter.new(app).to_hash
expect(result[:name]).to eq('file-based-service-bindings')
expect(result[:description]).to eq('Enable file-based service bindings for the app')
expect(result[:enabled]).to eq(app.file_based_service_bindings_enabled)
end
end
end
end

0 comments on commit 5b0b183

Please sign in to comment.