FIX: Cache url data for failed inline oneboxes

This commit is contained in:
Vinoth Kannan
2018-11-13 01:44:20 +05:30
parent 931480f7e3
commit 44d95ad5ab
3 changed files with 23 additions and 6 deletions

View File

@@ -39,6 +39,21 @@ describe InlineOneboxer do
expect(cached[:url]).to eq(topic.url)
expect(cached[:title]).to eq(topic.title)
end
it "puts an entry in the cache for failed onebox" do
SiteSetting.enable_inline_onebox_on_all_domains = true
url = "https://example.com/random-url"
expect(InlineOneboxer.cache_lookup(url)).to be_blank
result = InlineOneboxer.lookup(url)
expect(result).to be_present
cached = InlineOneboxer.cache_lookup(url)
expect(cached).to be_present
expect(cached[:url]).to eq(url)
expect(cached[:title]).to be_nil
end
end
context ".lookup" do