summaryrefslogtreecommitdiff
path: root/spec/models/user_custom_attribute_spec.rb
diff options
context:
space:
mode:
authorMarkus Koller <markus-koller@gmx.ch>2017-09-28 16:49:42 +0000
committerRémy Coutable <remy@rymai.me>2017-09-28 16:49:42 +0000
commite9eae3eb0dd25e4a34c9a4b6bcc7de312dde4489 (patch)
treed2402a99dd96927ae458f49cbd7de8ad043e297a /spec/models/user_custom_attribute_spec.rb
parent93a33556e3e01a83c1af9c21e11ff433b624c40d (diff)
downloadgitlab-ce-e9eae3eb0dd25e4a34c9a4b6bcc7de312dde4489.tar.gz
Support custom attributes on users
Diffstat (limited to 'spec/models/user_custom_attribute_spec.rb')
-rw-r--r--spec/models/user_custom_attribute_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/user_custom_attribute_spec.rb b/spec/models/user_custom_attribute_spec.rb
new file mode 100644
index 00000000000..37fc3cb64f0
--- /dev/null
+++ b/spec/models/user_custom_attribute_spec.rb
@@ -0,0 +1,16 @@
+require 'spec_helper'
+
+describe UserCustomAttribute do
+ describe 'assocations' do
+ it { is_expected.to belong_to(:user) }
+ end
+
+ describe 'validations' do
+ subject { build :user_custom_attribute }
+
+ it { is_expected.to validate_presence_of(:user_id) }
+ it { is_expected.to validate_presence_of(:key) }
+ it { is_expected.to validate_presence_of(:value) }
+ it { is_expected.to validate_uniqueness_of(:key).scoped_to(:user_id) }
+ end
+end