Commit 07a4a381 authored by Serena Fang's avatar Serena Fang

Expose is_auditor if auditor user available

parent be295ce3
......@@ -8,7 +8,7 @@ module EE
prepended do
expose :using_license_seat?, as: :using_license_seat
expose :auditor, as: :is_auditor
expose :auditor, as: :is_auditor, if: ->(_instance, _opts) { ::License.feature_available?(:auditor_user) }
end
end
end
......
......@@ -25,15 +25,27 @@ RSpec.describe ::EE::API::Entities::UserWithAdmin do
end
context 'is_auditor' do
it 'returns false when user is not an auditor' do
expect(subject[:is_auditor]).to be false
context 'when auditor_user is available' do
it 'returns false when user is not an auditor' do
expect(subject[:is_auditor]).to be false
end
context 'when user is an auditor' do
let(:user) { create(:user, :auditor) }
it 'returns true' do
expect(subject[:is_auditor]).to be true
end
end
end
context 'when user is an auditor' do
let(:user) { create(:user, :auditor) }
context 'when auditor_user is not available' do
before do
stub_licensed_features(auditor_user: false)
end
it 'returns true' do
expect(subject[:is_auditor]).to be true
it 'does not have the is_auditor param' do
expect(subject[:is_auditor]).to be nil
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