mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Cache oneboxes in Redis now instead of postgres.
This commit is contained in:
parent
9d4ecd7ef8
commit
babcfe6234
10 changed files with 88 additions and 153 deletions
|
@ -5,8 +5,8 @@ describe OneboxController do
|
|||
let(:url) { "http://google.com" }
|
||||
|
||||
it 'invalidates the cache if refresh is passed' do
|
||||
Oneboxer.expects(:invalidate).with(url)
|
||||
xhr :get, :show, url: url, refresh: true
|
||||
Oneboxer.expects(:onebox).with(url, invalidate_oneboxes: true)
|
||||
xhr :get, :show, url: url, refresh: 'true'
|
||||
end
|
||||
|
||||
describe "found onebox" do
|
||||
|
@ -14,7 +14,7 @@ describe OneboxController do
|
|||
let(:body) { "this is the onebox body"}
|
||||
|
||||
before do
|
||||
Oneboxer.expects(:preview).with(url).returns(body)
|
||||
Oneboxer.expects(:onebox).with(url, invalidate_oneboxes: false).returns(body)
|
||||
xhr :get, :show, url: url
|
||||
end
|
||||
|
||||
|
@ -31,13 +31,13 @@ describe OneboxController do
|
|||
describe "missing onebox" do
|
||||
|
||||
it "returns 404 if the onebox is nil" do
|
||||
Oneboxer.expects(:preview).with(url).returns(nil)
|
||||
Oneboxer.expects(:onebox).with(url, invalidate_oneboxes: false).returns(nil)
|
||||
xhr :get, :show, url: url
|
||||
response.response_code.should == 404
|
||||
end
|
||||
|
||||
it "returns 404 if the onebox is an empty string" do
|
||||
Oneboxer.expects(:preview).with(url).returns(" \t ")
|
||||
Oneboxer.expects(:onebox).with(url, invalidate_oneboxes: false).returns(" \t ")
|
||||
xhr :get, :show, url: url
|
||||
response.response_code.should == 404
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue