Commit 4c3785af authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'fix-path-regex' into 'master'

Fix path regex

Fixes #1208

See merge request !955
parents ac1ff491 6a0cb250
...@@ -72,7 +72,7 @@ module Gitlab ...@@ -72,7 +72,7 @@ module Gitlab
end end
def default_regex def default_regex
/\A[.?]?[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*(?<!\.git)\z/ /\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
end end
end end
end end
require 'spec_helper'
describe Gitlab::Regex do
describe 'path regex' do
it { 'gitlab-ce'.should match(Gitlab::Regex.path_regex) }
it { 'gitlab_git'.should match(Gitlab::Regex.path_regex) }
it { '_underscore.js'.should match(Gitlab::Regex.path_regex) }
it { '100px.com'.should match(Gitlab::Regex.path_regex) }
it { '?gitlab'.should_not match(Gitlab::Regex.path_regex) }
it { 'git lab'.should_not match(Gitlab::Regex.path_regex) }
it { 'gitlab.git'.should_not match(Gitlab::Regex.path_regex) }
end
describe 'project name regex' do
it { 'gitlab-ce'.should match(Gitlab::Regex.project_name_regex) }
it { 'GitLab CE'.should match(Gitlab::Regex.project_name_regex) }
it { '100 lines'.should match(Gitlab::Regex.project_name_regex) }
it { 'gitlab.git'.should match(Gitlab::Regex.project_name_regex) }
it { '?gitlab'.should_not match(Gitlab::Regex.project_name_regex) }
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment