This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2017-04-25 02:47:31 +02:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe FetchLinkCardService do
|
|
|
|
before do
|
2017-05-10 23:30:07 +02:00
|
|
|
stub_request(:head, 'http://example.xn--fiqs8s/').to_return(status: 200, headers: { 'Content-Type' => 'text/html' })
|
2017-04-25 02:47:31 +02:00
|
|
|
stub_request(:get, 'http://example.xn--fiqs8s/').to_return(request_fixture('idn.txt'))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'works with IDN URLs' do
|
|
|
|
status = Fabricate(:status, text: 'Check out http://example.中国')
|
|
|
|
|
|
|
|
FetchLinkCardService.new.call(status)
|
2017-04-27 14:42:22 +02:00
|
|
|
expect(a_request(:get, 'http://example.xn--fiqs8s/')).to have_been_made.at_least_once
|
2017-04-25 02:47:31 +02:00
|
|
|
end
|
|
|
|
end
|