diff options
author | Mark Chao <mchao@gitlab.com> | 2019-05-02 22:01:57 +0300 |
---|---|---|
committer | Mark Chao <mchao@gitlab.com> | 2019-05-02 22:02:59 +0300 |
commit | c7e8f5c613754a7221d6b2f0b0e154b75c55dd84 (patch) | |
tree | c8cb52ba5647ebda4151966639b5855c38266b27 /spec/lib/gitlab/git_ref_validator_spec.rb | |
parent | 76469b508234c0528cbb5afb22e2dd776c11d56b (diff) |
Refactor spec to not use truthy or falsey
Diffstat (limited to 'spec/lib/gitlab/git_ref_validator_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git_ref_validator_spec.rb | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/spec/lib/gitlab/git_ref_validator_spec.rb b/spec/lib/gitlab/git_ref_validator_spec.rb index 6fc41cd64f9..b63389af29f 100644 --- a/spec/lib/gitlab/git_ref_validator_spec.rb +++ b/spec/lib/gitlab/git_ref_validator_spec.rb @@ -4,66 +4,66 @@ describe Gitlab::GitRefValidator do using RSpec::Parameterized::TableSyntax context '.validate' do - 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 } - it { expect(described_class.validate('my-branch')).to be_truthy } - 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 } - it { expect(described_class.validate('-')).to be_falsey } - it { expect(described_class.validate('-branch')).to be_falsey } - it { expect(described_class.validate('+foo:bar')).to be_falsey } - it { expect(described_class.validate('foo:bar')).to be_falsey } - it { expect(described_class.validate('.tag')).to be_falsey } - it { expect(described_class.validate('my branch')).to be_falsey } - it { expect(described_class.validate("\xA0\u0000\xB0")).to be_falsey } + it { expect(described_class.validate('feature/new')).to be true } + it { expect(described_class.validate('implement_@all')).to be true } + it { expect(described_class.validate('my_new_feature')).to be true } + it { expect(described_class.validate('my-branch')).to be true } + it { expect(described_class.validate('#1')).to be true } + it { expect(described_class.validate('feature/refs/heads/foo')).to be true } + it { expect(described_class.validate('feature/~new/')).to be false } + it { expect(described_class.validate('feature/^new/')).to be false } + it { expect(described_class.validate('feature/:new/')).to be false } + it { expect(described_class.validate('feature/?new/')).to be false } + it { expect(described_class.validate('feature/*new/')).to be false } + it { expect(described_class.validate('feature/[new/')).to be false } + it { expect(described_class.validate('feature/new/')).to be false } + it { expect(described_class.validate('feature/new.')).to be false } + it { expect(described_class.validate('feature\@{')).to be false } + it { expect(described_class.validate('feature\new')).to be false } + it { expect(described_class.validate('feature//new')).to be false } + it { expect(described_class.validate('feature new')).to be false } + it { expect(described_class.validate('refs/heads/')).to be false } + it { expect(described_class.validate('refs/remotes/')).to be false } + it { expect(described_class.validate('refs/heads/feature')).to be false } + it { expect(described_class.validate('refs/remotes/origin')).to be false } + it { expect(described_class.validate('-')).to be false } + it { expect(described_class.validate('-branch')).to be false } + it { expect(described_class.validate('+foo:bar')).to be false } + it { expect(described_class.validate('foo:bar')).to be false } + it { expect(described_class.validate('.tag')).to be false } + it { expect(described_class.validate('my branch')).to be false } + it { expect(described_class.validate("\xA0\u0000\xB0")).to be false } end context '.validate_merge_request_branch' do - it { expect(described_class.validate_merge_request_branch('HEAD')).to be_truthy } - it { expect(described_class.validate_merge_request_branch('feature/new')).to be_truthy } - it { expect(described_class.validate_merge_request_branch('implement_@all')).to be_truthy } - it { expect(described_class.validate_merge_request_branch('my_new_feature')).to be_truthy } - it { expect(described_class.validate_merge_request_branch('my-branch')).to be_truthy } - it { expect(described_class.validate_merge_request_branch('#1')).to be_truthy } - it { expect(described_class.validate_merge_request_branch('feature/refs/heads/foo')).to be_truthy } - it { expect(described_class.validate_merge_request_branch('feature/~new/')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature/^new/')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature/:new/')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature/?new/')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature/*new/')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature/[new/')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature/new/')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature/new.')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature\@{')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature\new')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature//new')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('feature new')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('refs/heads/master')).to be_truthy } - it { expect(described_class.validate_merge_request_branch('refs/heads/')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('refs/remotes/')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('-')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('-branch')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('+foo:bar')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('foo:bar')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('.tag')).to be_falsey } - it { expect(described_class.validate_merge_request_branch('my branch')).to be_falsey } - it { expect(described_class.validate_merge_request_branch("\xA0\u0000\xB0")).to be_falsey } + it { expect(described_class.validate_merge_request_branch('HEAD')).to be true } + it { expect(described_class.validate_merge_request_branch('feature/new')).to be true } + it { expect(described_class.validate_merge_request_branch('implement_@all')).to be true } + it { expect(described_class.validate_merge_request_branch('my_new_feature')).to be true } + it { expect(described_class.validate_merge_request_branch('my-branch')).to be true } + it { expect(described_class.validate_merge_request_branch('#1')).to be true } + it { expect(described_class.validate_merge_request_branch('feature/refs/heads/foo')).to be true } + it { expect(described_class.validate_merge_request_branch('feature/~new/')).to be false } + it { expect(described_class.validate_merge_request_branch('feature/^new/')).to be false } + it { expect(described_class.validate_merge_request_branch('feature/:new/')).to be false } + it { expect(described_class.validate_merge_request_branch('feature/?new/')).to be false } + it { expect(described_class.validate_merge_request_branch('feature/*new/')).to be false } + it { expect(described_class.validate_merge_request_branch('feature/[new/')).to be false } + it { expect(described_class.validate_merge_request_branch('feature/new/')).to be false } + it { expect(described_class.validate_merge_request_branch('feature/new.')).to be false } + it { expect(described_class.validate_merge_request_branch('feature\@{')).to be false } + it { expect(described_class.validate_merge_request_branch('feature\new')).to be false } + it { expect(described_class.validate_merge_request_branch('feature//new')).to be false } + it { expect(described_class.validate_merge_request_branch('feature new')).to be false } + it { expect(described_class.validate_merge_request_branch('refs/heads/master')).to be true } + it { expect(described_class.validate_merge_request_branch('refs/heads/')).to be false } + it { expect(described_class.validate_merge_request_branch('refs/remotes/')).to be false } + it { expect(described_class.validate_merge_request_branch('-')).to be false } + it { expect(described_class.validate_merge_request_branch('-branch')).to be false } + it { expect(described_class.validate_merge_request_branch('+foo:bar')).to be false } + it { expect(described_class.validate_merge_request_branch('foo:bar')).to be false } + it { expect(described_class.validate_merge_request_branch('.tag')).to be false } + it { expect(described_class.validate_merge_request_branch('my branch')).to be false } + it { expect(described_class.validate_merge_request_branch("\xA0\u0000\xB0")).to be false } end end |