Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-11-04 15:08:58 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-11-04 15:08:58 +0300
commit3968b07d7ea1fd2ca07e427a487ea94ca0c6081d (patch)
treefedd5455aab03f821ae44373a994b2bf06f12d9c /spec/serializers/user_entity_spec.rb
parentc315332b8a90d26197ad93a6e982888aa575e2d4 (diff)
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.rb23
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