FEATURE: Support multisite in PostgreSQL fallback adapter.

This commit is contained in:
Guo Xiang Tan
2016-02-29 18:58:42 +08:00
parent 280ca372a3
commit b41aa27a84
4 changed files with 143 additions and 50 deletions

View File

@ -111,8 +111,12 @@ describe Discourse do
end
it "returns true when the key is present in redis" do
$redis.expects(:get).with(Discourse.readonly_mode_key).returns("1")
expect(Discourse.readonly_mode?).to eq(true)
begin
$redis.set(Discourse.readonly_mode_key, 1)
expect(Discourse.readonly_mode?).to eq(true)
ensure
$redis.del(Discourse.readonly_mode_key)
end
end
it "returns true when Discourse is recently read only" do
@ -121,6 +125,13 @@ describe Discourse do
end
end
context ".received_readonly!" do
it "sets the right time" do
time = Discourse.received_readonly!
expect(Discourse.last_read_only['default']).to eq(time)
end
end
context "#handle_exception" do
class TempSidekiqLogger < Sidekiq::ExceptionHandler::Logger