Commit d4141f69 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'ab/projects-validate-feature-presence' into 'master'

Add validation for project_feature

See merge request gitlab-org/gitlab!24588
parents 25f4e5f4 f203f891
......@@ -358,6 +358,8 @@ class Project < ApplicationRecord
project_path: true,
length: { maximum: 255 }
validates :project_feature, presence: true
validates :namespace, presence: true
validates :name, uniqueness: { scope: :namespace_id }
validates :import_url, public_url: { schemes: ->(project) { project.persisted? ? VALID_MIRROR_PROTOCOLS : VALID_IMPORT_PROTOCOLS },
......
......@@ -279,6 +279,12 @@ describe Project do
end
end
it 'validates presence of project_feature' do
project = build(:project, project_feature: nil)
expect(project).not_to be_valid
end
describe 'import_url' do
it 'does not allow an invalid URI as import_url' do
project = build(:project, import_url: 'invalid://')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment