diff --git a/lib/open_project/github_integration/notification_handlers.rb b/lib/open_project/github_integration/notification_handlers.rb index 3984095cd1..631b7c2d4f 100644 --- a/lib/open_project/github_integration/notification_handlers.rb +++ b/lib/open_project/github_integration/notification_handlers.rb @@ -32,7 +32,7 @@ module OpenProject::GithubIntegration # source: string # Returns: # Array - def self.parse_work_package(source) + def self.extract_work_package_ids(source) # matches the following things (given that `Setting.host_name` equals 'www.openproject.org') # - http://www.openproject.org/wp/1234 # - https://www.openproject.org/wp/1234 diff --git a/spec/lib/notification_handlers_spec.rb b/spec/lib/notification_handlers_spec.rb index 9ebbf3de36..4e5a4212e3 100644 --- a/spec/lib/notification_handlers_spec.rb +++ b/spec/lib/notification_handlers_spec.rb @@ -8,28 +8,28 @@ describe OpenProject::GithubIntegration do describe '.parse_work_package' do it 'should return an empty array for an empty source' do result = OpenProject::GithubIntegration::NotificationHandlers.send( - :parse_work_package, '') + :extract_work_package_ids, '') expect(result).to eql([]) end it 'should find a plain work package url' do source = 'Blabla\nhttps://example.net/work_packages/234\n' result = OpenProject::GithubIntegration::NotificationHandlers.send( - :parse_work_package, source) + :extract_work_package_ids, source) expect(result).to eql([234]) end it 'should find a work package url in markdown link syntax' do source = 'Blabla\n[WP 234](https://example.net/work_packages/234)\n' result = OpenProject::GithubIntegration::NotificationHandlers.send( - :parse_work_package, source) + :extract_work_package_ids, source) expect(result).to eql([234]) end it 'should find multiple work package urls' do source = "I reference https://example.net/work_packages/434\n and Blabla\n[WP 234](https://example.net/wp/234)\n" result = OpenProject::GithubIntegration::NotificationHandlers.send( - :parse_work_package, source) + :extract_work_package_ids, source) expect(result).to eql([434, 234]) end