mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
Cache oneboxes in Redis now instead of postgres.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user