Commit 491ac7ce authored by Robert Speicher's avatar Robert Speicher

Merge branch 'issue-referenced-merge-requests-specs' into 'master'

Added specs for Issue#referenced_merge_requests

Added these while looking into https://gitlab.com/gitlab-org/gitlab-ce/issues/13651.

See merge request !3125
parents 60d0a20b e32726c6
...@@ -105,6 +105,31 @@ describe Issue, models: true do ...@@ -105,6 +105,31 @@ describe Issue, models: true do
end end
end end
describe '#referenced_merge_requests' do
it 'returns the referenced merge requests' do
project = create(:project, :public)
mr1 = create(:merge_request,
source_project: project,
source_branch: 'master',
target_branch: 'feature')
mr2 = create(:merge_request,
source_project: project,
source_branch: 'feature',
target_branch: 'master')
issue = create(:issue, description: mr1.to_reference, project: project)
create(:note_on_issue,
noteable: issue,
note: mr2.to_reference,
project_id: project.id)
expect(issue.referenced_merge_requests).to eq([mr1, mr2])
end
end
it_behaves_like 'an editable mentionable' do it_behaves_like 'an editable mentionable' do
subject { create(:issue) } subject { create(:issue) }
......
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