diff options
author | Sean McGivern <sean@gitlab.com> | 2017-03-03 14:25:52 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-03-06 14:18:49 +0000 |
commit | 9f612cc428c47a578bef8869e2e93966c021e655 (patch) | |
tree | ff03a6c9437a5a5b68219bf66978b756b514116c /spec/models/merge_request_spec.rb | |
parent | 86d1e42ab34d15a801b97d4d1b7812fb4259f7e5 (diff) | |
download | gitlab-ce-9f612cc428c47a578bef8869e2e93966c021e655.tar.gz |
Fix issues mentioned but not closed for JIRA
The `ReferenceExtractor` would return an array of `ExternalIssue`
objects, and then perform `Array#-` to remove the issues
closed. `ExternalIssue`s had `==` defined, but not `hash` or `eql?`,
which are used by `Array#-`.
Diffstat (limited to 'spec/models/merge_request_spec.rb')
-rw-r--r-- | spec/models/merge_request_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index e000d0d38b3..fcaf4c71182 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -346,6 +346,23 @@ describe MergeRequest, models: true do expect(subject.issues_mentioned_but_not_closing(subject.author)).to match_array([mentioned_issue]) end + + context 'when the project has an external issue tracker' do + before do + subject.project.team << [subject.author, :developer] + commit = double(:commit, safe_message: 'Fixes TEST-3') + + create(:jira_service, project: subject.project) + + allow(subject).to receive(:commits).and_return([commit]) + allow(subject).to receive(:description).and_return('Is related to TEST-2 and TEST-3') + allow(subject.project).to receive(:default_branch).and_return(subject.target_branch) + end + + it 'detects issues mentioned in description but not closed' do + expect(subject.issues_mentioned_but_not_closing(subject.author).map(&:to_s)).to match_array(['TEST-2']) + end + end end describe "#work_in_progress?" do |