debian-mirror-gitlab/spec/serializers/user_entity_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
656 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe UserEntity do
2017-09-10 17:25:29 +05:30
include Gitlab::Routing
2017-08-17 22:00:37 +05:30
let(:entity) { described_class.new(user) }
let(:user) { create(:user) }
2020-01-01 13:55:28 +05:30
2017-08-17 22:00:37 +05:30
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-09-10 17:25:29 +05:30
it 'exposes user path' do
expect(subject[:path]).to eq user_path(user)
end
2017-08-17 22:00:37 +05:30
end