Commit 7c1aaf68 authored by Stan Hu's avatar Stan Hu

Add spec for BitbucketServer::Representation::Repo

parent 48ea89af
......@@ -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
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment