Commit 3d317f30 authored by mo khan's avatar mo khan Committed by Ash McKenzie

Update serialization of ManagedLicenseEntity

parent 826f9186
......@@ -2,7 +2,10 @@
class ManagedLicenseEntity < Grape::Entity
expose :id
expose :classification, as: :approval_status
expose :classification, as: :approval_status do |policy|
SoftwareLicensePolicy::APPROVAL_STATUS.key(policy.classification) ||
policy.classification
end
expose :software_license, merge: true do
expose :name
end
......
......@@ -12,5 +12,20 @@ describe ManagedLicenseEntity do
it 'contains required fields' do
expect(subject).to include(:id, :name, :approval_status)
end
describe "#approval_status" do
where(:classification, :approval_status) do
[
['approved', 'approved'],
['denied', 'blacklisted']
]
end
with_them do
let(:software_license_policy) { build(:software_license_policy, classification: classification) }
it { expect(subject[:approval_status]).to eql(approval_status) }
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment