|
|
@ -8,28 +8,28 @@ describe OpenProject::GithubIntegration do |
|
|
|
describe '.parse_work_package' do |
|
|
|
describe '.parse_work_package' do |
|
|
|
it 'should return an empty array for an empty source' do |
|
|
|
it 'should return an empty array for an empty source' do |
|
|
|
result = OpenProject::GithubIntegration::NotificationHandlers.send( |
|
|
|
result = OpenProject::GithubIntegration::NotificationHandlers.send( |
|
|
|
:parse_work_package, '') |
|
|
|
:extract_work_package_ids, '') |
|
|
|
expect(result).to eql([]) |
|
|
|
expect(result).to eql([]) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'should find a plain work package url' do |
|
|
|
it 'should find a plain work package url' do |
|
|
|
source = 'Blabla\nhttps://example.net/work_packages/234\n' |
|
|
|
source = 'Blabla\nhttps://example.net/work_packages/234\n' |
|
|
|
result = OpenProject::GithubIntegration::NotificationHandlers.send( |
|
|
|
result = OpenProject::GithubIntegration::NotificationHandlers.send( |
|
|
|
:parse_work_package, source) |
|
|
|
:extract_work_package_ids, source) |
|
|
|
expect(result).to eql([234]) |
|
|
|
expect(result).to eql([234]) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'should find a work package url in markdown link syntax' do |
|
|
|
it 'should find a work package url in markdown link syntax' do |
|
|
|
source = 'Blabla\n[WP 234](https://example.net/work_packages/234)\n' |
|
|
|
source = 'Blabla\n[WP 234](https://example.net/work_packages/234)\n' |
|
|
|
result = OpenProject::GithubIntegration::NotificationHandlers.send( |
|
|
|
result = OpenProject::GithubIntegration::NotificationHandlers.send( |
|
|
|
:parse_work_package, source) |
|
|
|
:extract_work_package_ids, source) |
|
|
|
expect(result).to eql([234]) |
|
|
|
expect(result).to eql([234]) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'should find multiple work package urls' do |
|
|
|
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" |
|
|
|
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( |
|
|
|
result = OpenProject::GithubIntegration::NotificationHandlers.send( |
|
|
|
:parse_work_package, source) |
|
|
|
:extract_work_package_ids, source) |
|
|
|
expect(result).to eql([434, 234]) |
|
|
|
expect(result).to eql([434, 234]) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|