diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2014-10-05 21:04:16 +0200 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2014-10-05 21:04:16 +0200 |
commit | bb929c2117c8a45620eb37b55d43f5cb8a215572 (patch) | |
tree | e3d57450efa28c0f860d4472285fa8167dd1ea1e /spec/models/commit_spec.rb | |
parent | 43be3fcb833fe522721a7192fffd8d7348b01ffb (diff) | |
parent | 8dce0cd215b657d11b3e183e361fc86ae9314ecd (diff) | |
download | gitlab-ce-bb929c2117c8a45620eb37b55d43f5cb8a215572.tar.gz |
Merge pull request #7933 from mr-vinn/cross-project-markdown
Implement cross-project Markdown references
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r-- | spec/models/commit_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 1673184cbe4..6f201adc4e8 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -53,11 +53,23 @@ eos describe '#closes_issues' do let(:issue) { create :issue, project: project } + let(:other_project) { create :project, :public } + let(:other_issue) { create :issue, project: other_project } it 'detects issues that this commit is marked as closing' do - commit.stub(issue_closing_regex: /^([Cc]loses|[Ff]ixes) #\d+/, safe_message: "Fixes ##{issue.iid}") + stub_const('Gitlab::ClosingIssueExtractor::ISSUE_CLOSING_REGEX', + /Fixes #\d+/) + commit.stub(safe_message: "Fixes ##{issue.iid}") commit.closes_issues(project).should == [issue] end + + it 'does not detect issues from other projects' do + ext_ref = "#{other_project.path_with_namespace}##{other_issue.iid}" + stub_const('Gitlab::ClosingIssueExtractor::ISSUE_CLOSING_REGEX', + /^([Cc]loses|[Ff]ixes)/) + commit.stub(safe_message: "Fixes #{ext_ref}") + commit.closes_issues(project).should be_empty + end end it_behaves_like 'a mentionable' do |