This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2017-04-24 17:47:31 -07:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe FetchLinkCardService do
|
|
|
|
before do
|
2017-05-10 14:30:07 -07:00
|
|
|
stub_request(:head, 'http://example.xn--fiqs8s/').to_return(status: 200, headers: { 'Content-Type' => 'text/html' })
|
2017-04-24 17:47:31 -07: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 05:42:22 -07:00
|
|
|
expect(a_request(:get, 'http://example.xn--fiqs8s/')).to have_been_made.at_least_once
|
2017-04-24 17:47:31 -07:00
|
|
|
end
|
|
|
|
end
|