Commit 78e23f53 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Merge branch 'al-36750-expose-using-license-for-admin-users-api' into 'master'

Expose using_license_seat in users API for admins

See merge request gitlab-org/gitlab!43057
parents 9b264999 a68e0b6a
---
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