Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f203f891
Commit
f203f891
authored
Jan 27, 2020
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add validation for project_feature
Relates to:
https://gitlab.com/gitlab-org/gitlab/issues/34367
parent
4505da2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
app/models/project.rb
app/models/project.rb
+2
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+6
-0
No files found.
app/models/project.rb
View file @
f203f891
...
...
@@ -357,6 +357,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
},
...
...
spec/models/project_spec.rb
View file @
f203f891
...
...
@@ -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://'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment