diff options
author | Stan Hu <stanhu@gmail.com> | 2015-06-12 08:39:50 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-06-12 16:59:27 +0300 |
commit | d45112258e066da307975c17c5ca19ea9a17222b (patch) | |
tree | ff77b6428f81f9d97f330c821eb8b46a4389386b /spec/services | |
parent | 4e98159022c99d3fd857fc35015547fd93d830be (diff) |
Fix post-receive errors on a push when an external issue tracker is configured
Closes #1700
Closes #1720
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/git_push_service_spec.rb | 9 | ||||
-rw-r--r-- | spec/services/issues/close_service_spec.rb | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index e7558f28768..d0941fa2e07 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -233,6 +233,15 @@ describe GitPushService do expect(Issue.find(issue.id)).to be_opened end + + it "doesn't close issues when external issue tracker is in use" do + allow(project).to receive(:default_issues_tracker?).and_return(false) + + # The push still shouldn't create cross-reference notes. + expect { + service.execute(project, user, @oldrev, @newrev, 'refs/heads/hurf') + }.not_to change { Note.where(project_id: project.id, system: true).count } + end end describe "empty project" do diff --git a/spec/services/issues/close_service_spec.rb b/spec/services/issues/close_service_spec.rb index 0e5ae724bf7..db547ce0d50 100644 --- a/spec/services/issues/close_service_spec.rb +++ b/spec/services/issues/close_service_spec.rb @@ -31,5 +31,15 @@ describe Issues::CloseService do expect(note.note).to include "Status changed to closed" end end + + context "external issue tracker" do + before do + allow(project).to receive(:default_issues_tracker?).and_return(false) + @issue = Issues::CloseService.new(project, user, {}).execute(issue) + end + + it { expect(@issue).to be_valid } + it { expect(@issue).to be_opened } + end end end |