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
iv
gitlab-ce
Commits
eb51a4ac
Commit
eb51a4ac
authored
Jan 29, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor previous test and add validation to project model
parent
7ca67796
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
8 deletions
+5
-8
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+2
-2
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+3
-6
No files found.
lib/gitlab/regex.rb
View file @
eb51a4ac
...
@@ -34,12 +34,12 @@ module Gitlab
...
@@ -34,12 +34,12 @@ module Gitlab
def
project_path_regex
def
project_path_regex
@project_path_regex
||=
/\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
.
freeze
@project_path_regex
||=
/\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\.]*(?<!\.git
|\.atom
)\z/
.
freeze
end
end
def
project_path_regex_message
def
project_path_regex_message
"can contain only letters, digits, '_', '-' and '.'. "
\
"can contain only letters, digits, '_', '-' and '.'. "
\
"Cannot start with '-'
or end in '.git
'"
\
"Cannot start with '-'
, end in '.git' or end in '.atom
'"
\
end
end
...
...
spec/controllers/projects_controller_spec.rb
View file @
eb51a4ac
...
@@ -88,13 +88,10 @@ describe ProjectsController do
...
@@ -88,13 +88,10 @@ describe ProjectsController do
end
end
context
"when the url contains .atom"
do
context
"when the url contains .atom"
do
let
(
:public_project_with_dot
)
{
create
(
:project
,
:public
,
name:
'my.atom'
,
path:
'my.atom'
)
}
let
(
:public_project_with_dot
_atom
)
{
create
(
:project
,
:public
,
name:
'my.atom'
,
path:
'my.atom'
)
}
it
'loads a project'
do
it
'expect an error creating the project'
do
get
:show
,
namespace_id:
public_project_with_dot
.
namespace
.
path
,
id:
public_project_with_dot
.
path
expect
{
public_project_with_dot_atom
}.
to
raise_error
(
ActiveRecord
::
RecordInvalid
)
expect
(
assigns
(
:project
)).
to
eq
(
public_project_with_dot
)
expect
(
response
.
status
).
to
eq
(
200
)
end
end
end
end
end
end
...
...
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