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