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
7c1aaf68
Commit
7c1aaf68
authored
Jul 20, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for BitbucketServer::Representation::Repo
parent
48ea89af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
9 deletions
+77
-9
lib/bitbucket_server/representation/repo.rb
lib/bitbucket_server/representation/repo.rb
+1
-9
spec/lib/bitbucket_server/representation/repo_spec.rb
spec/lib/bitbucket_server/representation/repo_spec.rb
+76
-0
No files found.
lib/bitbucket_server/representation/repo.rb
View file @
7c1aaf68
...
...
@@ -9,10 +9,6 @@ module BitbucketServer
raw
.
dig
(
'project'
,
'name'
)
end
def
owner
project
[
'name'
]
end
def
slug
raw
[
'slug'
]
end
...
...
@@ -30,7 +26,7 @@ module BitbucketServer
end
def
full_name
"
#{
owner
}
/
#{
name
}
"
"
#{
project_name
}
/
#{
name
}
"
end
def
issues_enabled?
...
...
@@ -45,10 +41,6 @@ module BitbucketServer
raw
[
'scmId'
]
==
'git'
end
def
has_wiki?
false
end
def
visibility_level
if
project
[
'public'
]
Gitlab
::
VisibilityLevel
::
PUBLIC
...
...
spec/lib/bitbucket_server/representation/repo_spec.rb
0 → 100644
View file @
7c1aaf68
require
'spec_helper'
describe
BitbucketServer
::
Representation
::
Repo
do
let
(
:sample_data
)
do
<<~
DATA
{
"slug": "rouge",
"id": 1,
"name": "rouge",
"scmId": "git",
"state": "AVAILABLE",
"statusMessage": "Available",
"forkable": true,
"project": {
"key": "TEST",
"id": 1,
"name": "test",
"description": "Test",
"public": false,
"type": "NORMAL",
"links": {
"self": [
{
"href": "http://localhost:7990/projects/TEST"
}
]
}
},
"public": false,
"links": {
"clone": [
{
"href": "http://root@localhost:7990/scm/test/rouge.git",
"name": "http"
},
{
"href": "ssh://git@localhost:7999/test/rouge.git",
"name": "ssh"
}
],
"self": [
{
"href": "http://localhost:7990/projects/TEST/repos/rouge/browse"
}
]
}
}
DATA
end
subject
{
described_class
.
new
(
JSON
.
parse
(
sample_data
))
}
describe
'#project_name'
do
it
{
expect
(
subject
.
project_name
).
to
eq
(
'test'
)
}
end
describe
'#slug'
do
it
{
expect
(
subject
.
slug
).
to
eq
(
'rouge'
)
}
end
describe
'#browse_url'
do
it
{
expect
(
subject
.
browse_url
).
to
eq
(
'http://localhost:7990/projects/TEST/repos/rouge/browse'
)
}
end
describe
'#clone_url'
do
it
{
expect
(
subject
.
clone_url
).
to
eq
(
'http://root@localhost:7990/scm/test/rouge.git'
)
}
end
describe
'#description'
do
it
{
expect
(
subject
.
description
).
to
eq
(
'Test'
)
}
end
describe
'#full_name'
do
it
{
expect
(
subject
.
full_name
).
to
eq
(
'test/rouge'
)
}
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