2017-04-25 00:47:31 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe FetchLinkCardService do
|
|
|
|
before do
|
2017-05-10 21:30:07 +00:00
|
|
|
stub_request(:head, 'http://example.xn--fiqs8s/').to_return(status: 200, headers: { 'Content-Type' => 'text/html' })
|
2017-04-25 00:47:31 +00: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 12:42:22 +00:00
|
|
|
expect(a_request(:get, 'http://example.xn--fiqs8s/')).to have_been_made.at_least_once
|
2017-04-25 00:47:31 +00:00
|
|
|
end
|
|
|
|
end
|