Skip to content

Commit

Permalink
[512] Expose the inactive status
Browse files Browse the repository at this point in the history
  • Loading branch information
avinhurry committed Dec 18, 2024
1 parent c3d741c commit 2849ba1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/lib/vendor_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ module VendorAPI
Changes::V15::AddApplicationSentToProviderDatetime,
Changes::V15::AddReferenceFeedbackProvidedAtDatetime,
],
'1.6pre' => [Changes::V16::AddConfidentialToReference],
'1.6pre' => [
Changes::V16::AddConfidentialToReference,
Changes::V16::AddInactiveToApplicationAttributeStatuses,
],
}.freeze
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module VendorAPI
module Changes
module V16
class AddInactiveToApplicationAttributeStatuses < VersionChange
description 'Add inactive to the application attributes'
resource ApplicationPresenter, [ApplicationPresenter::AddInactiveStatus]
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module VendorAPI::ApplicationPresenter::AddInactiveStatus
def schema
super.deep_merge(
attributes: {
inactive: @application_choice.inactive?,
},
)
end
end
16 changes: 16 additions & 0 deletions spec/presenters/vendor_api/v1.6/application_presenter_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'rails_helper'

RSpec.describe VendorAPI::ApplicationPresenter do
let(:application_json) { described_class.new(version, application_choice).as_json }
let(:version) { '1.6' }

describe '#status' do
context 'when the application choice is inactive' do
let(:application_choice) { create(:application_choice, :inactive) }

it 'returns the status as inactive' do
expect(application_json.dig(:attributes, :inactive)).to be(true)
end
end
end
end

0 comments on commit 2849ba1

Please sign in to comment.