2014-07-27 10:40:00 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe Gitlab::GitRefValidator do
|
2017-07-25 13:09:00 -04:00
|
|
|
it { expect(described_class.validate('feature/new')).to be_truthy }
|
|
|
|
it { expect(described_class.validate('implement_@all')).to be_truthy }
|
|
|
|
it { expect(described_class.validate('my_new_feature')).to be_truthy }
|
2017-10-05 11:05:48 -04:00
|
|
|
it { expect(described_class.validate('my-branch')).to be_truthy }
|
2017-07-25 13:09:00 -04:00
|
|
|
it { expect(described_class.validate('#1')).to be_truthy }
|
|
|
|
it { expect(described_class.validate('feature/refs/heads/foo')).to be_truthy }
|
|
|
|
it { expect(described_class.validate('feature/~new/')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature/^new/')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature/:new/')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature/?new/')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature/*new/')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature/[new/')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature/new/')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature/new.')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature\@{')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature\new')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature//new')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('feature new')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('refs/heads/')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('refs/remotes/')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('refs/heads/feature')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('refs/remotes/origin')).to be_falsey }
|
2017-10-05 11:05:48 -04:00
|
|
|
it { expect(described_class.validate('-')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('-branch')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('.tag')).to be_falsey }
|
|
|
|
it { expect(described_class.validate('my branch')).to be_falsey }
|
2014-07-27 10:40:00 -04:00
|
|
|
end
|