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
Boxiang Sun
gitlab-ce
Commits
8fe05d83
Commit
8fe05d83
authored
Sep 19, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix validation regexs (+1 squashed commit)
Squashed commits: [f9a9315] Use : to test invalid environment name
parent
31e8721a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+2
-2
spec/features/environments_spec.rb
spec/features/environments_spec.rb
+1
-1
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+2
-2
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+2
-2
No files found.
lib/gitlab/regex.rb
View file @
8fe05d83
...
@@ -96,11 +96,11 @@ module Gitlab
...
@@ -96,11 +96,11 @@ module Gitlab
end
end
def
environment_name_regex
def
environment_name_regex
@environment_name_regex
||=
/\A[a-zA-Z0-9_\\\/\${} -]+\z/
.
freeze
@environment_name_regex
||=
/\A[a-zA-Z0-9_\\\/\${}
.
-]+\z/
.
freeze
end
end
def
environment_name_regex_message
def
environment_name_regex_message
"can contain only letters, digits, '-', '_', '/', '$', '{', '}' and spaces"
"can contain only letters, digits, '-', '_', '/', '$', '{', '}'
, '.'
and spaces"
end
end
end
end
end
end
spec/features/environments_spec.rb
View file @
8fe05d83
...
@@ -150,7 +150,7 @@ feature 'Environments', feature: true do
...
@@ -150,7 +150,7 @@ feature 'Environments', feature: true do
context
'for invalid name'
do
context
'for invalid name'
do
before
do
before
do
fill_in
(
'Name'
,
with:
'name
with space
s'
)
fill_in
(
'Name'
,
with:
'name
,with,comma
s'
)
click_on
'Save'
click_on
'Save'
end
end
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
8fe05d83
...
@@ -790,10 +790,10 @@ module Ci
...
@@ -790,10 +790,10 @@ module Ci
end
end
context
'is not a valid string'
do
context
'is not a valid string'
do
let
(
:environment
)
{
'production
staging'
}
let
(
:environment
)
{
'production
:
staging'
}
it
'raises error'
do
it
'raises error'
do
expect
{
builds
}.
to
raise_error
(
"jobs:deploy_to_production
environment
#{
Gitlab
::
Regex
.
environment_name_regex_message
}
"
)
expect
{
builds
}.
to
raise_error
(
"jobs:deploy_to_production
:environment name
#{
Gitlab
::
Regex
.
environment_name_regex_message
}
"
)
end
end
end
end
end
end
...
...
spec/models/environment_spec.rb
View file @
8fe05d83
...
@@ -68,13 +68,13 @@ describe Environment, models: true do
...
@@ -68,13 +68,13 @@ describe Environment, models: true do
subject
{
environment
.
environment_type
}
subject
{
environment
.
environment_type
}
it
'sets a environment type if name has multiple segments'
do
it
'sets a environment type if name has multiple segments'
do
environment
.
update
(
name:
'production/worker.gitlab.com'
)
environment
.
update
!
(
name:
'production/worker.gitlab.com'
)
is_expected
.
to
eq
(
'production'
)
is_expected
.
to
eq
(
'production'
)
end
end
it
'nullifies a type if it\'s a simple name'
do
it
'nullifies a type if it\'s a simple name'
do
environment
.
update
(
name:
'production'
)
environment
.
update
!
(
name:
'production'
)
is_expected
.
to
be_nil
is_expected
.
to
be_nil
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