2019-04-30 08:27:42 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-28 10:27:38 +08:00
|
|
|
RSpec.describe AdminDashboardData do
|
2021-12-20 07:59:11 +08:00
|
|
|
after do
|
|
|
|
AdminDashboardData.reset_problem_checks
|
|
|
|
Discourse.redis.flushdb
|
|
|
|
end
|
2013-03-20 11:18:00 +08:00
|
|
|
|
2021-12-20 07:59:11 +08:00
|
|
|
describe "stats cache" do
|
|
|
|
include_examples "stats cacheable"
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#problem_message_check" do
|
2024-06-20 16:33:01 +08:00
|
|
|
let(:key) { "new_key" }
|
2021-12-20 07:59:11 +08:00
|
|
|
|
|
|
|
after { described_class.clear_problem_message(key) }
|
|
|
|
|
|
|
|
it "returns nil if message has not been added" do
|
|
|
|
expect(described_class.problem_message_check(key)).to be_nil
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns a message if it was added" do
|
|
|
|
described_class.add_problem_message(key)
|
|
|
|
expect(described_class.problem_message_check(key)).to eq(
|
|
|
|
I18n.t(key, base_path: Discourse.base_path),
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns a message if it was added with an expiry" do
|
|
|
|
described_class.add_problem_message(key, 300)
|
|
|
|
expect(described_class.problem_message_check(key)).to eq(
|
|
|
|
I18n.t(key, base_path: Discourse.base_path),
|
|
|
|
)
|
2015-08-26 08:07:40 +08:00
|
|
|
end
|
|
|
|
end
|
2013-04-30 10:43:21 +08:00
|
|
|
end
|