debian-mirror-gitlab/spec/lib/gitlab/regex_spec.rb

33 lines
1.4 KiB
Ruby
Raw Normal View History

2015-09-11 14:41:01 +05:30
# coding: utf-8
2014-09-02 18:07:02 +05:30
require 'spec_helper'
2015-12-23 02:04:40 +05:30
describe Gitlab::Regex, lib: true do
2015-04-26 12:48:37 +05:30
describe 'project path regex' do
it { expect('gitlab-ce').to match(Gitlab::Regex.project_path_regex) }
it { expect('gitlab_git').to match(Gitlab::Regex.project_path_regex) }
it { expect('_underscore.js').to match(Gitlab::Regex.project_path_regex) }
it { expect('100px.com').to match(Gitlab::Regex.project_path_regex) }
it { expect('?gitlab').not_to match(Gitlab::Regex.project_path_regex) }
it { expect('git lab').not_to match(Gitlab::Regex.project_path_regex) }
it { expect('gitlab.git').not_to match(Gitlab::Regex.project_path_regex) }
2014-09-02 18:07:02 +05:30
end
describe 'project name regex' do
2015-04-26 12:48:37 +05:30
it { expect('gitlab-ce').to match(Gitlab::Regex.project_name_regex) }
it { expect('GitLab CE').to match(Gitlab::Regex.project_name_regex) }
it { expect('100 lines').to match(Gitlab::Regex.project_name_regex) }
it { expect('gitlab.git').to match(Gitlab::Regex.project_name_regex) }
2015-09-11 14:41:01 +05:30
it { expect('Český název').to match(Gitlab::Regex.project_name_regex) }
it { expect('Dash is this').to match(Gitlab::Regex.project_name_regex) }
2015-04-26 12:48:37 +05:30
it { expect('?gitlab').not_to match(Gitlab::Regex.project_name_regex) }
2014-09-02 18:07:02 +05:30
end
2016-04-02 18:10:28 +05:30
describe 'file name regex' do
it { expect('foo@bar').to match(Gitlab::Regex.file_name_regex) }
end
describe 'file path regex' do
it { expect('foo@/bar').to match(Gitlab::Regex.file_path_regex) }
end
2014-09-02 18:07:02 +05:30
end