diff options
author | Nick Thomas <nick@gitlab.com> | 2018-08-01 19:56:20 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-08-01 19:56:20 +0000 |
commit | 9812e5dd7c52e67b22781a440ee04dbb2a086000 (patch) | |
tree | 860229eba147b2eaaa7561686760604d4763ad0b /spec/models | |
parent | 92e079ede29d4d1e1c4a36166aa76ea13e3412d3 (diff) | |
parent | 79a5d76801a45696db629e1f543f2e1d6fa4784f (diff) | |
download | gitlab-ce-9812e5dd7c52e67b22781a440ee04dbb2a086000.tar.gz |
Merge branch 'zj-repository-languages' into 'master'
Add repository languages for projects
Closes #23931, #34671, #48647, and #47301
See merge request gitlab-org/gitlab-ce!19480
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/programming_language_spec.rb | 11 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 1 | ||||
-rw-r--r-- | spec/models/repository_language_spec.rb | 16 |
3 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/programming_language_spec.rb b/spec/models/programming_language_spec.rb new file mode 100644 index 00000000000..99cd358f863 --- /dev/null +++ b/spec/models/programming_language_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe ProgrammingLanguage do + it { is_expected.to respond_to(:name) } + it { is_expected.to respond_to(:color) } + + it { is_expected.to validate_presence_of(:name) } + it { is_expected.to allow_value("#000000").for(:color) } + it { is_expected.not_to allow_value("000000").for(:color) } + it { is_expected.not_to allow_value("#0z0000").for(:color) } +end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index ef4167a3912..340d2d95500 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -69,6 +69,7 @@ describe Project do it { is_expected.to have_many(:pages_domains) } it { is_expected.to have_many(:labels).class_name('ProjectLabel') } it { is_expected.to have_many(:users_star_projects) } + it { is_expected.to have_many(:repository_languages) } it { is_expected.to have_many(:environments) } it { is_expected.to have_many(:deployments) } it { is_expected.to have_many(:todos) } diff --git a/spec/models/repository_language_spec.rb b/spec/models/repository_language_spec.rb new file mode 100644 index 00000000000..e2e4beb512f --- /dev/null +++ b/spec/models/repository_language_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe RepositoryLanguage do + let(:repository_language) { build(:repository_language) } + + describe 'associations' do + it { is_expected.to belong_to(:project) } + it { is_expected.to belong_to(:programming_language) } + end + + describe 'validations' do + it { is_expected.to allow_value(0).for(:share) } + it { is_expected.to allow_value(100.0).for(:share) } + it { is_expected.not_to allow_value(100.1).for(:share) } + end +end |