Commit 0a79c85b authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'vij-add-ci-additional-pack-entity' into 'master'

Add Ci::Minutes::AdditionalPack Grape entity

See merge request gitlab-org/gitlab!63651
parents ca1c41a9 855c03a0
# frozen_string_literal: true
module EE
module API
module Entities
module Ci
module Minutes
class AdditionalPack < Grape::Entity
expose :namespace_id
expose :expires_at
expose :number_of_minutes
expose :purchase_xid
end
end
end
end
end
end
# frozen_string_literal: true
FactoryBot.define do
factory :ci_minutes_additional_pack, class: 'Ci::Minutes::AdditionalPack' do
namespace
number_of_minutes { 10_000 }
expires_at { Date.current + 1.year }
purchase_xid { SecureRandom.hex(16) }
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ::EE::API::Entities::Ci::Minutes::AdditionalPack do
it 'contains the correct attributes', :aggregate_failures do
pack = build(:ci_minutes_additional_pack)
entity = described_class.new(pack).as_json
expect(entity[:expires_at]).to eq pack.expires_at
expect(entity[:namespace_id]).to eq pack.namespace_id
expect(entity[:number_of_minutes]).to eq pack.number_of_minutes
expect(entity[:purchase_xid]).to eq pack.purchase_xid
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