2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe BitbucketServer::Representation::Repo do
|
2018-11-18 11:00:15 +05:30
|
|
|
let(:sample_data) do
|
|
|
|
<<~DATA
|
|
|
|
{
|
|
|
|
"slug": "rouge",
|
|
|
|
"id": 1,
|
|
|
|
"name": "rouge",
|
2022-04-04 11:22:00 +05:30
|
|
|
"description": "Rogue Repo",
|
2018-11-18 11:00:15 +05:30
|
|
|
"scmId": "git",
|
|
|
|
"state": "AVAILABLE",
|
|
|
|
"statusMessage": "Available",
|
|
|
|
"forkable": true,
|
|
|
|
"project": {
|
|
|
|
"key": "TEST",
|
|
|
|
"id": 1,
|
|
|
|
"name": "test",
|
2022-04-04 11:22:00 +05:30
|
|
|
"description": "Test Project",
|
2018-11-18 11:00:15 +05:30
|
|
|
"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
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
subject { described_class.new(Gitlab::Json.parse(sample_data)) }
|
2018-11-18 11:00:15 +05:30
|
|
|
|
|
|
|
describe '#project_key' do
|
|
|
|
it { expect(subject.project_key).to eq('TEST') }
|
|
|
|
end
|
|
|
|
|
|
|
|
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
|
2022-04-04 11:22:00 +05:30
|
|
|
it { expect(subject.description).to eq('Rogue Repo') }
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe '#full_name' do
|
|
|
|
it { expect(subject.full_name).to eq('test/rouge') }
|
|
|
|
end
|
|
|
|
end
|