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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
6fefa794
Commit
6fefa794
authored
Apr 03, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate uniqueness of container repository name
parent
e10dae3e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
app/models/container_repository.rb
app/models/container_repository.rb
+1
-0
spec/models/container_repository_spec.rb
spec/models/container_repository_spec.rb
+7
-0
No files found.
app/models/container_repository.rb
View file @
6fefa794
...
...
@@ -2,6 +2,7 @@ class ContainerRepository < ActiveRecord::Base
belongs_to
:project
validates
:name
,
length:
{
minimum:
0
,
allow_nil:
false
}
validates
:name
,
uniqueness:
{
scope: :project_id
}
delegate
:client
,
to: :registry
...
...
spec/models/container_repository_spec.rb
View file @
6fefa794
...
...
@@ -21,6 +21,13 @@ describe ContainerRepository do
headers:
{
'Content-Type'
=>
'application/json'
})
end
describe
'validations'
do
it
'validates uniqueness of name scoped to project'
do
expect
(
subject
).
to
validate_uniqueness_of
(
:name
)
.
scoped_to
(
:project_id
)
end
end
describe
'associations'
do
it
'belongs to the project'
do
expect
(
container_repository
).
to
belong_to
(
:project
)
...
...
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