FIX: Embedding was broken with non-english URLs and ports

This commit is contained in:
Robin Ward
2017-02-27 12:17:52 -05:00
parent 877957ae88
commit bf9626d031
2 changed files with 15 additions and 2 deletions

View File

@ -49,12 +49,21 @@ describe EmbeddableHost do
expect(eh).not_to be_valid
end
describe "it works with ports" do
let!(:host) { Fabricate(:embeddable_host, host: 'localhost:8000') }
it "works as expected" do
expect(EmbeddableHost.url_allowed?('http://localhost:8000/eviltrout')).to eq(true)
end
end
describe "url_allowed?" do
let!(:host) { Fabricate(:embeddable_host) }
it 'works as expected' do
expect(EmbeddableHost.url_allowed?('http://eviltrout.com')).to eq(true)
expect(EmbeddableHost.url_allowed?('https://eviltrout.com')).to eq(true)
expect(EmbeddableHost.url_allowed?('https://eviltrout.com/انگلیسی')).to eq(true)
expect(EmbeddableHost.url_allowed?('https://not-eviltrout.com')).to eq(false)
end