BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
container_repository.rb
app/models/container_repository.rb
+1
-0
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