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
Boxiang Sun
gitlab-ce
Commits
2b4883e0
Commit
2b4883e0
authored
Nov 16, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for Tag/Branch corectness
parent
b6c8d3ac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
spec/models/project_spec.rb
spec/models/project_spec.rb
+11
-3
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+10
-2
No files found.
spec/models/project_spec.rb
View file @
2b4883e0
...
@@ -2805,7 +2805,7 @@ describe Project do
...
@@ -2805,7 +2805,7 @@ describe Project do
context
'when ref exists'
do
context
'when ref exists'
do
let
(
:ref
)
{
'refs/heads/master'
}
let
(
:ref
)
{
'refs/heads/master'
}
it
'returns
the
ref'
do
it
'returns
a
ref'
do
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Ref
)
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Ref
)
end
end
end
end
...
@@ -2838,9 +2838,13 @@ describe Project do
...
@@ -2838,9 +2838,13 @@ describe Project do
project
.
repository
.
add_tag
(
project
.
creator
,
ref
,
'master'
)
project
.
repository
.
add_tag
(
project
.
creator
,
ref
,
'master'
)
end
end
it
'returns
full tag ref path
'
do
it
'returns
a tag
'
do
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Tag
)
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Tag
)
end
end
it
'returns the correct tag'
do
expect
(
subject
.
name
).
to
eq
(
ref
)
end
end
end
context
'when ref is branch name'
do
context
'when ref is branch name'
do
...
@@ -2848,9 +2852,13 @@ describe Project do
...
@@ -2848,9 +2852,13 @@ describe Project do
project
.
repository
.
add_branch
(
project
.
creator
,
ref
,
'master'
)
project
.
repository
.
add_branch
(
project
.
creator
,
ref
,
'master'
)
end
end
it
'returns
full branch ref pat
h'
do
it
'returns
a branc
h'
do
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Branch
)
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Branch
)
end
end
it
'returns the correct branch'
do
expect
(
subject
.
name
).
to
eq
(
ref
)
end
end
end
end
end
end
end
...
...
spec/models/repository_spec.rb
View file @
2b4883e0
...
@@ -1705,17 +1705,25 @@ describe Repository do
...
@@ -1705,17 +1705,25 @@ describe Repository do
context
'when ref is a tag'
do
context
'when ref is a tag'
do
let
(
:ref
)
{
'refs/tags/v1.0.0'
}
let
(
:ref
)
{
'refs/tags/v1.0.0'
}
it
'returns
the
tag'
do
it
'returns
a
tag'
do
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Tag
)
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Tag
)
end
end
it
'returns the correct tag'
do
expect
(
subject
.
name
).
to
eq
(
'v1.0.0'
)
end
end
end
context
'when ref is a branch'
do
context
'when ref is a branch'
do
let
(
:ref
)
{
'refs/heads/master'
}
let
(
:ref
)
{
'refs/heads/master'
}
it
'returns
the
branch'
do
it
'returns
a
branch'
do
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Branch
)
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Branch
)
end
end
it
'returns the correct branch'
do
expect
(
subject
.
name
).
to
eq
(
'master'
)
end
end
end
context
'when ref is invalid'
do
context
'when ref is invalid'
do
...
...
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