FIX: Random Redis connection timeout failure in Travis.
This commit is contained in:
parent
f891430f32
commit
e3e31441b8
|
@ -1,16 +1,16 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Jobs::AboutStats do
|
||||
after do
|
||||
$redis.flushall
|
||||
end
|
||||
|
||||
it 'caches the stats' do
|
||||
stats = About.fetch_stats.to_json
|
||||
cache_key = About.stats_cache_key
|
||||
begin
|
||||
stats = About.fetch_stats.to_json
|
||||
cache_key = About.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)
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Jobs::DashboardStats do
|
||||
after do
|
||||
$redis.flushall
|
||||
end
|
||||
|
||||
it 'caches the stats' do
|
||||
Timecop.freeze do
|
||||
stats = AdminDashboardData.fetch_stats.to_json
|
||||
cache_key = AdminDashboardData.stats_cache_key
|
||||
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)
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@ describe Jobs::PollMailbox do
|
|||
end
|
||||
|
||||
after do
|
||||
$redis.flushall
|
||||
$redis.del(Jobs::PollMailbox::POLL_MAILBOX_TIMEOUT_ERROR_KEY)
|
||||
end
|
||||
|
||||
it "add an admin dashboard message on pop authentication error" do
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
shared_examples_for 'stats cachable' do
|
||||
describe 'fetch_cached_stats' do
|
||||
after do
|
||||
$redis.flushall
|
||||
$redis.del(described_class.stats_cache_key)
|
||||
end
|
||||
|
||||
it 'returns the cached stats' do
|
||||
|
|
Loading…
Reference in New Issue