|
|
|
@ -193,6 +193,19 @@ RSpec.describe FetchLinkCardService do
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with an URL too long for PostgreSQL unique indexes' do
|
|
|
|
|
let(:url) { "http://example.com/#{'a' * 2674}" }
|
|
|
|
|
let(:status) { Fabricate(:status, text: url) }
|
|
|
|
|
|
|
|
|
|
it 'does not fetch the URL' do
|
|
|
|
|
expect(a_request(:get, url)).to_not have_been_made
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'does not create a preview card' do
|
|
|
|
|
expect(status.preview_card).to be_nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'with a URL of a page with oEmbed support' do
|
|
|
|
|
let(:html) { '<!doctype html><title>Hello world</title><link rel="alternate" type="application/json+oembed" href="http://example.com/oembed?url=http://example.com/html">' }
|
|
|
|
|
let(:status) { Fabricate(:status, text: 'http://example.com/html') }
|
|
|
|
|