2019-07-17 02:41:26 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe Gitlab::ZoomLinkExtractor do
|
2019-07-17 02:41:26 -04:00
|
|
|
describe "#links" do
|
|
|
|
using RSpec::Parameterized::TableSyntax
|
|
|
|
|
|
|
|
where(:text, :links) do
|
|
|
|
'issue text https://zoom.us/j/123 and https://zoom.us/s/1123433' | %w[https://zoom.us/j/123 https://zoom.us/s/1123433]
|
|
|
|
'https://zoom.us/j/1123433 issue text' | %w[https://zoom.us/j/1123433]
|
|
|
|
'issue https://zoom.us/my/1123433 text' | %w[https://zoom.us/my/1123433]
|
|
|
|
'issue https://gitlab.com and https://gitlab.zoom.us/s/1123433' | %w[https://gitlab.zoom.us/s/1123433]
|
|
|
|
'https://gitlab.zoom.us/j/1123433' | %w[https://gitlab.zoom.us/j/1123433]
|
|
|
|
'https://gitlab.zoom.us/my/1123433' | %w[https://gitlab.zoom.us/my/1123433]
|
|
|
|
end
|
|
|
|
|
|
|
|
with_them do
|
|
|
|
subject { described_class.new(text).links }
|
|
|
|
|
|
|
|
it { is_expected.to eq(links) }
|
|
|
|
end
|
2019-07-20 05:06:19 -04:00
|
|
|
|
|
|
|
describe '#match?' do
|
|
|
|
it 'is true when a zoom link found' do
|
|
|
|
expect(described_class.new('issue text https://zoom.us/j/123')).to be_match
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'is false when no zoom link found' do
|
|
|
|
expect(described_class.new('issue text')).not_to be_match
|
|
|
|
end
|
|
|
|
end
|
2019-07-17 02:41:26 -04:00
|
|
|
end
|
|
|
|
end
|