2019-09-30 05:06:31 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-04 08:08:58 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe UserEntity do
|
2017-06-02 09:24:42 -04:00
|
|
|
include Gitlab::Routing
|
|
|
|
|
2016-11-04 08:08:58 -04:00
|
|
|
let(:entity) { described_class.new(user) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
subject { entity.as_json }
|
|
|
|
|
|
|
|
it 'exposes user name and login' do
|
|
|
|
expect(subject).to include(:username, :name)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not expose passwords' do
|
|
|
|
expect(subject).not_to include(/password/)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not expose tokens' do
|
|
|
|
expect(subject).not_to include(/token/)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not expose 2FA OTPs' do
|
|
|
|
expect(subject).not_to include(/otp/)
|
|
|
|
end
|
2017-06-02 09:24:42 -04:00
|
|
|
|
|
|
|
it 'exposes user path' do
|
|
|
|
expect(subject[:path]).to eq user_path(user)
|
|
|
|
end
|
2016-11-04 08:08:58 -04:00
|
|
|
end
|