Commit 78c8bce1 authored by Berna Castro's avatar Berna Castro Committed by Oswaldo Ferreira

Fix and add specs for Issue#to_reference

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