diff options
author | Markus Koller <markus-koller@gmx.ch> | 2017-09-18 15:03:24 +0200 |
---|---|---|
committer | Markus Koller <markus.koller.ext@siemens.com> | 2017-11-06 10:51:46 +0100 |
commit | 6902848a9c54f9eb1bfd82fe173ad0d5d62fe2d5 (patch) | |
tree | 9a28f3a4e52c7e6108a7f0358f813a375eec90a2 /spec/models | |
parent | 823a9d351b49a6be8c12cfe06edb4aa6ec08fe95 (diff) | |
download | gitlab-ce-6902848a9c54f9eb1bfd82fe173ad0d5d62fe2d5.tar.gz |
Support custom attributes on projects
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/project_custom_attribute_spec.rb | 16 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/project_custom_attribute_spec.rb b/spec/models/project_custom_attribute_spec.rb new file mode 100644 index 00000000000..669de5506bc --- /dev/null +++ b/spec/models/project_custom_attribute_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe ProjectCustomAttribute do + describe 'assocations' do + it { is_expected.to belong_to(:project) } + end + + describe 'validations' do + subject { build :project_custom_attribute } + + it { is_expected.to validate_presence_of(:project) } + 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(:project_id) } + end +end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index e8588975118..88987bae4a5 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -79,6 +79,7 @@ describe Project do it { is_expected.to have_many(:pipeline_schedules) } it { is_expected.to have_many(:members_and_requesters) } it { is_expected.to have_one(:cluster) } + it { is_expected.to have_many(:custom_attributes).class_name('ProjectCustomAttribute') } context 'after initialized' do it "has a project_feature" do |