Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-08 19:15:23 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-08 19:15:23 +0400
commit6a0cb250966e3bca5bd0dcda82505bfd905167a7 (patch)
tree173c1143b4da63931d89df796c8c81a375265374 /spec/lib/gitlab/regex_spec.rb
parentac1ff491b4f68890381a6e397a342a78962ecad3 (diff)
Dont allow ? in project path
Because it causes 500 error on every page where link to such project exists Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/lib/gitlab/regex_spec.rb')
-rw-r--r--spec/lib/gitlab/regex_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb
new file mode 100644
index 00000000000..a3aae7771bd
--- /dev/null
+++ b/spec/lib/gitlab/regex_spec.rb
@@ -0,0 +1,21 @@
+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