Fix and add specs for Issue#to_reference

This commit is contained in:
Berna Castro 2016-12-15 13:50:28 +01:00 committed by Oswaldo Ferreira
parent 1c749880e5
commit 78c8bce1ff
1 changed files with 10 additions and 1 deletions

View File

@ -27,7 +27,11 @@ describe Issue, models: true do
let(:issue) { build(:issue, iid: 1, project: project) }
it 'returns a String reference to the object' do
expect(issue.to_reference).to eq "#1"
expect(issue.to_reference).to eq "#{project.namespace.name}/sample-project#1"
end
it 'supports a project reference' do
expect(issue.to_reference(project)).to eq "#1"
end
it 'returns a String reference with the full path' do
@ -38,6 +42,11 @@ describe Issue, models: true do
another_project = build(:empty_project, name: 'another-project', namespace: project.namespace)
expect(issue.to_reference(another_project)).to eq "sample-project#1"
end
it 'supports a group reference' do
group = build(:group, name: 'sample-group')
expect(issue.to_reference(nil, group)).to eq("sample-project#1")
end
end
describe '#is_being_reassigned?' do