Commit 08481a71 authored by Berna Castro's avatar Berna Castro Committed by Oswaldo Ferreira

Fix and add specs for Project#to_reference

parent 78c8bce1
...@@ -287,8 +287,8 @@ describe Project, models: true do ...@@ -287,8 +287,8 @@ describe Project, models: true do
let(:project) { create(:empty_project, path: 'sample-project', namespace: namespace) } let(:project) { create(:empty_project, path: 'sample-project', namespace: namespace) }
context 'when nil argument' do context 'when nil argument' do
it 'returns nil' do it 'returns complete path to the project' do
expect(project.to_reference).to be_nil expect(project.to_reference).to eq 'sample-namespace/sample-project'
end end
end end
...@@ -309,10 +309,16 @@ describe Project, models: true do ...@@ -309,10 +309,16 @@ describe Project, models: true do
context 'when same namespace / cross-project argument' do context 'when same namespace / cross-project argument' do
let(:another_project) { create(:empty_project, namespace: namespace) } let(:another_project) { create(:empty_project, namespace: namespace) }
it 'returns complete path to the project' do it 'returns path to the project' do
expect(project.to_reference(another_project)).to eq 'sample-project' expect(project.to_reference(another_project)).to eq 'sample-project'
end end
end end
context 'when group argument' do
it 'returns path to the project' do
expect(project.to_reference(nil, namespace)).to eq 'sample-project'
end
end
end end
describe '#to_human_reference' do describe '#to_human_reference' do
......
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