Commit 78f221d1 authored by Gabriel Gizotti's avatar Gabriel Gizotti

describe #closes_issues and describe # #issues_mentioned_but_not_closing on merge_request_spec.rb

parent d1980ef9
...@@ -252,7 +252,7 @@ describe MergeRequest, models: true do ...@@ -252,7 +252,7 @@ describe MergeRequest, models: true do
end end
end end
describe 'detection of issues' do describe '#closes_issues' do
let(:issue0) { create :issue, project: subject.project } let(:issue0) { create :issue, project: subject.project }
let(:issue1) { create :issue, project: subject.project } let(:issue1) { create :issue, project: subject.project }
...@@ -265,7 +265,6 @@ describe MergeRequest, models: true do ...@@ -265,7 +265,6 @@ describe MergeRequest, models: true do
allow(subject).to receive(:commits).and_return([commit0, commit1, commit2]) allow(subject).to receive(:commits).and_return([commit0, commit1, commit2])
end end
describe 'detection of issues to be closed' do
it 'accesses the set of issues that will be closed on acceptance' do it 'accesses the set of issues that will be closed on acceptance' do
allow(subject.project).to receive(:default_branch). allow(subject.project).to receive(:default_branch).
and_return(subject.target_branch) and_return(subject.target_branch)
...@@ -281,22 +280,13 @@ describe MergeRequest, models: true do ...@@ -281,22 +280,13 @@ describe MergeRequest, models: true do
expect(subject.closes_issues).to be_empty expect(subject.closes_issues).to be_empty
end end
it 'detects issues mentioned in the description' do
issue2 = create(:issue, project: subject.project)
subject.description = "Closes #{issue2.to_reference}"
allow(subject.project).to receive(:default_branch).
and_return(subject.target_branch)
expect(subject.closes_issues).to include(issue2)
end
end end
describe '#issues_mentioned_but_not_closing' do
it 'detects issues mentioned in description but not closed' do it 'detects issues mentioned in description but not closed' do
mentioned_issue = create(:issue, project: subject.project) mentioned_issue = create(:issue, project: subject.project)
subject.project.team << [subject.author, :developer]
subject.description = "Is related to #{mentioned_issue.to_reference}" subject.description = "Is related to #{mentioned_issue.to_reference}"
allow(subject.project).to receive(:default_branch). allow(subject.project).to receive(:default_branch).
......
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