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:
authorMarkus Koller <markus-koller@gmx.ch>2017-09-18 18:07:38 +0300
committerMarkus Koller <markus.koller.ext@siemens.com>2017-11-06 12:51:50 +0300
commit1f773a8ef5a1f76166d0455c6a5e473278885c17 (patch)
treeed2d955865b49aa5d102ccb4b4f64868d4d12b77 /spec/models
parent6902848a9c54f9eb1bfd82fe173ad0d5d62fe2d5 (diff)
Support custom attributes on groups
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/group_custom_attribute_spec.rb16
-rw-r--r--spec/models/group_spec.rb1
2 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/group_custom_attribute_spec.rb b/spec/models/group_custom_attribute_spec.rb
new file mode 100644
index 00000000000..7ecb2022567
--- /dev/null
+++ b/spec/models/group_custom_attribute_spec.rb
@@ -0,0 +1,16 @@
+require 'spec_helper'
+
+describe GroupCustomAttribute do
+ describe 'assocations' do
+ it { is_expected.to belong_to(:group) }
+ end
+
+ describe 'validations' do
+ subject { build :group_custom_attribute }
+
+ it { is_expected.to validate_presence_of(:group) }
+ 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(:group_id) }
+ end
+end
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index 0e1a7fdce0b..c8caa11b8b0 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -17,6 +17,7 @@ describe Group do
it { is_expected.to have_many(:variables).class_name('Ci::GroupVariable') }
it { is_expected.to have_many(:uploads).dependent(:destroy) }
it { is_expected.to have_one(:chat_team) }
+ it { is_expected.to have_many(:custom_attributes).class_name('GroupCustomAttribute') }
describe '#members & #requesters' do
let(:requester) { create(:user) }