From b412fd1ff9e0aad9214def86e94313542cdf9544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 8 May 2018 21:57:46 +0200 Subject: [PATCH] Fix invalid spec --- lib/open_project/github_integration/notification_handlers.rb | 3 ++- spec/lib/notification_handlers_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/open_project/github_integration/notification_handlers.rb b/lib/open_project/github_integration/notification_handlers.rb index 084420527a..acc088dba5 100644 --- a/lib/open_project/github_integration/notification_handlers.rb +++ b/lib/open_project/github_integration/notification_handlers.rb @@ -102,7 +102,8 @@ module OpenProject::GithubIntegration # - https://www.openproject.org/subdirectory/work_packages/1234 # Or with the following prefix: OP# # e.g.,: This is a reference to OP#1234 - wp_regex = /OP#(\d+)|http(?:s?):\/\/#{Regexp.escape('openproject.org')}\/(?:\S+?\/)*(?:work_packages|wp)\/([0-9]+)/ + host_name = Regexp.escape(Setting.host_name) + wp_regex = /OP#(\d+)|http(?:s?):\/\/#{host_name}\/(?:\S+?\/)*(?:work_packages|wp)\/([0-9]+)/ source.scan(wp_regex) .map {|first, second| (first || second).to_i } diff --git a/spec/lib/notification_handlers_spec.rb b/spec/lib/notification_handlers_spec.rb index a5d7e8382f..71fa9de8cd 100644 --- a/spec/lib/notification_handlers_spec.rb +++ b/spec/lib/notification_handlers_spec.rb @@ -27,7 +27,7 @@ describe OpenProject::GithubIntegration do end it 'should find a plain work package url' do - source = 'Blabla\n#OP1234\n' + source = "Blabla\nOP#1234\n" result = OpenProject::GithubIntegration::NotificationHandlers.send( :extract_work_package_ids, source) expect(result).to eql([1234])