FIX: Ignore OneBox blacklisted domains.

This commit is contained in:
Bianca Nenciu
2018-08-26 16:31:02 +02:00
parent b12cf08c57
commit b6963b8ffb
4 changed files with 38 additions and 11 deletions

View File

@ -107,4 +107,13 @@ describe Oneboxer do
end
end
it "does not crawl blacklisted URLs" do
SiteSetting.onebox_domains_blacklist = "git.*.com|bitbucket.com"
url = 'https://github.com/discourse/discourse/commit/21b562852885f883be43032e03c709241e8e6d4f'
stub_request(:head, 'https://discourse.org/').to_return(status: 302, body: "", headers: { location: url })
expect(Oneboxer.external_onebox(url)[:onebox]).to be_empty
expect(Oneboxer.external_onebox('https://discourse.org/')[:onebox]).to be_empty
end
end