mirror of
https://github.com/discourse/discourse.git
synced 2025-03-13 03:55:20 +08:00
16 lines
496 B
Ruby
16 lines
496 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Onebox::Engine::CoubOnebox do
|
|
describe ".matches_regexp" do
|
|
it "matches valid coub URL" do
|
|
valid_url = URI("https://coub.com/view/12345")
|
|
expect(described_class === valid_url).to eq(true)
|
|
end
|
|
|
|
it "does not match malicious URL with valid domain as part of another domain" do
|
|
malicious_url = URI("https://coub.com.malicious.com/view/12345")
|
|
expect(described_class === malicious_url).to eq(false)
|
|
end
|
|
end
|
|
end
|