Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
c7e8f5c6
Commit
c7e8f5c6
authored
May 03, 2019
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor spec to not use truthy or falsey
parent
76469b50
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
58 deletions
+58
-58
spec/lib/gitlab/git_ref_validator_spec.rb
spec/lib/gitlab/git_ref_validator_spec.rb
+58
-58
No files found.
spec/lib/gitlab/git_ref_validator_spec.rb
View file @
c7e8f5c6
...
...
@@ -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\u
0000
\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\u
0000
\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\u
0000
\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\u
0000
\xB0
"
)).
to
be
false
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment