mirror of
https://github.com/discourse/discourse.git
synced 2025-06-23 17:22:53 +08:00
21 lines
708 B
Ruby
21 lines
708 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Onebox::Engine::FlickrOnebox do
|
|
describe ".===" do
|
|
it "matches valid Flickr photos URL" do
|
|
valid_url = URI("https://www.flickr.com/photos/username/123456/")
|
|
expect(described_class === valid_url).to eq(true)
|
|
end
|
|
|
|
it "does not match URL with valid domain as part of another domain" do
|
|
malicious_url = URI("https://www.flickr.com.malicious.com/photos/username/123456/")
|
|
expect(described_class === malicious_url).to eq(false)
|
|
end
|
|
|
|
it "does not match invalid path" do
|
|
invalid_path_url = URI("https://www.flickr.com/invalid/123456/")
|
|
expect(described_class === invalid_path_url).to eq(false)
|
|
end
|
|
end
|
|
end
|