summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/git_ref_validator_spec.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-04-25 13:28:55 +0100
committerSean McGivern <sean@gitlab.com>2017-04-26 12:50:32 +0100
commit5069682d8ed892705ec1a933554cc4060e5691af (patch)
treee2f286cf4ebd2678acf845d066146854885126ab /spec/lib/gitlab/git_ref_validator_spec.rb
parent6dc424c949ab3de9395d821b05d2e1cc5f632ed2 (diff)
downloadgitlab-ce-5069682d8ed892705ec1a933554cc4060e5691af.tar.gz
Enable RSpec/FilePath copenable-spec-file-name-cop
- Ignore JS fixtures - Ignore qa directory - Rewrite concern specs to put concern name first
Diffstat (limited to 'spec/lib/gitlab/git_ref_validator_spec.rb')
-rw-r--r--spec/lib/gitlab/git_ref_validator_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git_ref_validator_spec.rb b/spec/lib/gitlab/git_ref_validator_spec.rb
new file mode 100644
index 00000000000..cc8daa535d6
--- /dev/null
+++ b/spec/lib/gitlab/git_ref_validator_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+describe Gitlab::GitRefValidator, lib: true do
+ it { expect(Gitlab::GitRefValidator.validate('feature/new')).to be_truthy }
+ it { expect(Gitlab::GitRefValidator.validate('implement_@all')).to be_truthy }
+ it { expect(Gitlab::GitRefValidator.validate('my_new_feature')).to be_truthy }
+ it { expect(Gitlab::GitRefValidator.validate('#1')).to be_truthy }
+ it { expect(Gitlab::GitRefValidator.validate('feature/refs/heads/foo')).to be_truthy }
+ it { expect(Gitlab::GitRefValidator.validate('feature/~new/')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature/^new/')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature/:new/')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature/?new/')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature/*new/')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature/[new/')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature/new/')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature/new.')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature\@{')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature\new')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature//new')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('feature new')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('refs/heads/')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('refs/remotes/')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('refs/heads/feature')).to be_falsey }
+ it { expect(Gitlab::GitRefValidator.validate('refs/remotes/origin')).to be_falsey }
+end