Fix invalid spec

pull/6827/head
Oliver Günther 7 years ago
parent def1dbfbdf
commit b412fd1ff9
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 3
      lib/open_project/github_integration/notification_handlers.rb
  2. 2
      spec/lib/notification_handlers_spec.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 }

@ -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])

Loading…
Cancel
Save