Commit a68e0b6a authored by Amparo Luna's avatar Amparo Luna Committed by Gabriel Mazetto

Expose using_license_seat in users API for admins

parent f751d0f8
---
title: Expose using_license_seat in users API for admins
merge_request: 43057
author:
type: added
# frozen_string_literal: true
module EE
module API
module Entities
module UserWithAdmin
extend ActiveSupport::Concern
prepended do
expose :using_license_seat?, as: :using_license_seat
end
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ::EE::API::Entities::UserWithAdmin do
subject { entity.as_json }
let_it_be(:user) { create(:user) }
let(:entity) { ::API::Entities::UserWithAdmin.new(user) }
context 'using_license_seat' do
context 'when user is using seat' do
it 'returns true' do
expect(subject[:using_license_seat]).to be true
end
end
context 'when user is not using seat' do
it 'returns false' do
allow(user).to receive(:using_license_seat?).and_return(false)
expect(subject[:using_license_seat]).to be false
end
end
end
end
......@@ -8,3 +8,5 @@ module API
end
end
end
API::Entities::UserWithAdmin.prepend_if_ee('EE::API::Entities::UserWithAdmin')
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