BigW Consortium Gitlab

regex_spec.rb 1.41 KB
Newer Older
1
# coding: utf-8
2 3
require 'spec_helper'

Douwe Maan committed
4
describe Gitlab::Regex, lib: true do
Douwe Maan committed
5 6 7 8 9 10 11 12
  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) }
13 14 15
  end

  describe 'project name regex' do
16 17 18 19
    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) }
20 21
    it { expect('Český název').to match(Gitlab::Regex.project_name_regex) }
    it { expect('Dash – is this').to match(Gitlab::Regex.project_name_regex) }
22
    it { expect('?gitlab').not_to match(Gitlab::Regex.project_name_regex) }
23
  end
24 25 26 27 28 29 30 31

  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
32
end