diff options
author | Paco Guzman <pacoguzmanp@gmail.com> | 2016-08-04 11:56:58 +0200 |
---|---|---|
committer | Paco Guzman <pacoguzmanp@gmail.com> | 2016-08-04 12:38:08 +0200 |
commit | fa54a8e984949227b2b56ecd20e37e0c6ba498cd (patch) | |
tree | 7d4cf9b7d7d025a37af8114d2bf04fec71163fa3 /spec/lib | |
parent | 8890376f0f72f713a7530bd7989e71442c69dc91 (diff) | |
download | gitlab-ce-fa54a8e984949227b2b56ecd20e37e0c6ba498cd.tar.gz |
Don’t close issues on original project from a fork
Signed-off-by: Paco Guzman <pacoguzmanp@gmail.com>
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/closing_issue_extractor_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/lib/gitlab/closing_issue_extractor_spec.rb b/spec/lib/gitlab/closing_issue_extractor_spec.rb index e9b8ce6b5bb..de3f64249a2 100644 --- a/spec/lib/gitlab/closing_issue_extractor_spec.rb +++ b/spec/lib/gitlab/closing_issue_extractor_spec.rb @@ -3,10 +3,12 @@ require 'spec_helper' describe Gitlab::ClosingIssueExtractor, lib: true do let(:project) { create(:project) } let(:project2) { create(:project) } + let(:forked_project) { Projects::ForkService.new(project, project.creator).execute } let(:issue) { create(:issue, project: project) } let(:issue2) { create(:issue, project: project2) } let(:reference) { issue.to_reference } let(:cross_reference) { issue2.to_reference(project) } + let(:fork_cross_reference) { issue.to_reference(forked_project) } subject { described_class.new(project, project.creator) } @@ -278,6 +280,15 @@ describe Gitlab::ClosingIssueExtractor, lib: true do end end + context "with a cross-project fork reference" do + subject { described_class.new(forked_project, forked_project.creator) } + + it do + message = "Closes #{fork_cross_reference}" + expect(subject.closed_by_message(message)).to be_empty + end + end + context "with an invalid URL" do it do message = "Closes https://google.com#{urls.namespace_project_issue_path(issue2.project.namespace, issue2.project, issue2)}" |