diff options
author | Berna Castro <bernacas@gmail.com> | 2016-12-15 15:50:28 +0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-01-28 01:20:17 +0300 |
commit | 78c8bce1ff0017a1f1b8129bb5c6cb31992cf5d9 (patch) | |
tree | 0210851b4ca52ddccedd1496c7e3dc32c9f8955c /spec/models | |
parent | 1c749880e51b641e0e3385c58a3aa289fd1bbbb6 (diff) |
Fix and add specs for Issue#to_reference
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/issue_spec.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 40c0a75c364..5c37141e3ad 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -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 |