diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-04 13:08:58 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-04 13:08:58 +0100 |
commit | 3968b07d7ea1fd2ca07e427a487ea94ca0c6081d (patch) | |
tree | fedd5455aab03f821ae44373a994b2bf06f12d9c /spec/serializers/user_entity_spec.rb | |
parent | c315332b8a90d26197ad93a6e982888aa575e2d4 (diff) | |
download | gitlab-ce-3968b07d7ea1fd2ca07e427a487ea94ca0c6081d.tar.gz |
Add tests for serialization entities, add user entity
Diffstat (limited to 'spec/serializers/user_entity_spec.rb')
-rw-r--r-- | spec/serializers/user_entity_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/serializers/user_entity_spec.rb b/spec/serializers/user_entity_spec.rb new file mode 100644 index 00000000000..c5d11cbcf5e --- /dev/null +++ b/spec/serializers/user_entity_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe UserEntity do + 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 +end |