2015-10-11 05:41:23 -04:00
|
|
|
require 'rails_helper'
|
2015-07-07 00:52:19 -04:00
|
|
|
|
|
|
|
describe Jobs::DashboardStats do
|
|
|
|
it 'caches the stats' do
|
2017-07-24 09:17:42 -04:00
|
|
|
freeze_time
|
2016-04-21 02:45:16 -04:00
|
|
|
|
2017-07-24 09:17:42 -04:00
|
|
|
begin
|
|
|
|
stats = AdminDashboardData.fetch_stats.to_json
|
|
|
|
cache_key = AdminDashboardData.stats_cache_key
|
|
|
|
|
|
|
|
expect($redis.get(cache_key)).to eq(nil)
|
|
|
|
expect(described_class.new.execute({})).to eq(stats)
|
|
|
|
expect($redis.get(cache_key)).to eq(stats)
|
|
|
|
ensure
|
|
|
|
$redis.del(cache_key)
|
2016-04-21 02:45:16 -04:00
|
|
|
end
|
2015-07-07 00:52:19 -04:00
|
|
|
end
|
|
|
|
end
|