2019-04-30 08:27:42 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-10-11 17:41:23 +08:00
|
|
|
require 'rails_helper'
|
2015-07-07 12:52:19 +08:00
|
|
|
|
|
|
|
describe Jobs::AboutStats do
|
|
|
|
it 'caches the stats' do
|
2016-05-18 10:42:40 +08:00
|
|
|
begin
|
|
|
|
stats = About.fetch_stats.to_json
|
|
|
|
cache_key = About.stats_cache_key
|
2019-12-03 17:05:53 +08:00
|
|
|
Discourse.redis.del(cache_key)
|
2016-04-21 14:45:16 +08:00
|
|
|
|
2016-05-18 10:42:40 +08:00
|
|
|
expect(described_class.new.execute({})).to eq(stats)
|
2019-12-03 17:05:53 +08:00
|
|
|
expect(Discourse.redis.get(cache_key)).to eq(stats)
|
2016-05-18 10:42:40 +08:00
|
|
|
ensure
|
2019-12-03 17:05:53 +08:00
|
|
|
Discourse.redis.del(cache_key)
|
2016-05-18 10:42:40 +08:00
|
|
|
end
|
2015-07-07 12:52:19 +08:00
|
|
|
end
|
|
|
|
end
|