Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Gizotti <gabriel@gizotti.com>2016-11-24 00:50:49 +0300
committerGabriel Gizotti <gabriel@gizotti.com>2016-12-16 12:13:17 +0300
commit1a8f43ff3e5481d65f547ac01c03e2d64e14fff0 (patch)
treedb3d96d27fee723ce9225df063a3dbfc219f1468 /spec/models/merge_request_spec.rb
parente52e3ab5082599fd5a895de961b07584421a5cd2 (diff)
introduce MergeRequest#issues_mentioned_but_not_closing
Diffstat (limited to 'spec/models/merge_request_spec.rb')
-rw-r--r--spec/models/merge_request_spec.rb45
1 files changed, 30 insertions, 15 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index e1f9d66714d..688c78fb404 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -252,7 +252,7 @@ describe MergeRequest, models: true do
end
end
- describe 'detection of issues to be closed' do
+ describe 'detection of issues' do
let(:issue0) { create :issue, project: subject.project }
let(:issue1) { create :issue, project: subject.project }
@@ -265,29 +265,44 @@ describe MergeRequest, models: true do
allow(subject).to receive(:commits).and_return([commit0, commit1, commit2])
end
- it 'accesses the set of issues that will be closed on acceptance' do
- allow(subject.project).to receive(:default_branch).
- and_return(subject.target_branch)
+ describe 'detection of issues to be closed' do
+ it 'accesses the set of issues that will be closed on acceptance' do
+ allow(subject.project).to receive(:default_branch).
+ and_return(subject.target_branch)
- closed = subject.closes_issues
+ closed = subject.closes_issues
- expect(closed).to include(issue0, issue1)
- end
+ expect(closed).to include(issue0, issue1)
+ end
+
+ it 'only lists issues as to be closed if it targets the default branch' do
+ allow(subject.project).to receive(:default_branch).and_return('master')
+ subject.target_branch = 'something-else'
+
+ expect(subject.closes_issues).to be_empty
+ end
+
+ it 'detects issues mentioned in the description' do
+ issue2 = create(:issue, project: subject.project)
+
+ subject.description = "Closes #{issue2.to_reference}"
- it 'only lists issues as to be closed if it targets the default branch' do
- allow(subject.project).to receive(:default_branch).and_return('master')
- subject.target_branch = 'something-else'
+ allow(subject.project).to receive(:default_branch).
+ and_return(subject.target_branch)
- expect(subject.closes_issues).to be_empty
+ expect(subject.closes_issues).to include(issue2)
+ end
end
- it 'detects issues mentioned in the description' do
- issue2 = create(:issue, project: subject.project)
- subject.description = "Closes #{issue2.to_reference}"
+ it 'detects issues mentioned but not closed' do
+ mentioned_issue = create(:issue, project: subject.project)
+
+ subject.description = "Is related to #{mentioned_issue.to_reference}"
+
allow(subject.project).to receive(:default_branch).
and_return(subject.target_branch)
- expect(subject.closes_issues).to include(issue2)
+ expect(subject.issues_mentioned_but_not_closing).to match_array([mentioned_issue])
end
end