2015-10-11 04:41:23 -05:00
|
|
|
require 'rails_helper'
|
2015-07-06 23:52:19 -05:00
|
|
|
|
|
|
|
describe Jobs::DashboardStats do
|
|
|
|
it 'caches the stats' do
|
2016-04-21 01:45:16 -05:00
|
|
|
Timecop.freeze do
|
2016-05-17 21:42:40 -05:00
|
|
|
begin
|
|
|
|
stats = AdminDashboardData.fetch_stats.to_json
|
|
|
|
cache_key = AdminDashboardData.stats_cache_key
|
2016-04-21 01:45:16 -05:00
|
|
|
|
2016-05-17 21:42:40 -05:00
|
|
|
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)
|
|
|
|
end
|
2016-04-21 01:45:16 -05:00
|
|
|
end
|
2015-07-06 23:52:19 -05:00
|
|
|
end
|
|
|
|
end
|