FIX: More errors with non-ascii URLs

This commit is contained in:
Robin Ward
2017-03-07 11:21:26 -05:00
parent d1e587c10a
commit dad57fa033
3 changed files with 21 additions and 4 deletions

View File

@ -176,7 +176,23 @@ describe TopicEmbed do
it 'img node doesn\'t have other class' do
expect(response.body).to have_tag('img', without: { class: 'other' })
end
end
context "non-ascii URL" do
let(:url) { 'http://eviltrout.com/test/ماهی' }
let(:contents) { "<title>سلام</title><body>این یک پاراگراف آزمون است.</body>" }
let!(:embeddable_host) { Fabricate(:embeddable_host) }
let!(:file) { StringIO.new }
before do
file.stubs(:read).returns contents
TopicEmbed.stubs(:open).returns file
end
it "doesn't throw an error" do
response = TopicEmbed.find_remote(url)
expect(response.title).to eq("سلام")
end
end
end