Workaround for intermittently failing redis spec

This commit is contained in:
David Taylor 2017-07-24 17:48:06 +01:00
parent 858533a788
commit 681f37bc2b
1 changed files with 6 additions and 3 deletions

View File

@ -304,12 +304,15 @@ RSpec.describe DiscourseChat::Manager do
describe '.save_transcript' do
it 'saves a transcript to redis' do
freeze_time
key = DiscourseChat::Helper.save_transcript("Some content here")
expect($redis.get("chat_integration:transcript:#{key}")).to eq("Some content here")
expect($redis.pttl("chat_integration:transcript:#{key}")).to eq(3600*1000)
ttl = $redis.pttl("chat_integration:transcript:#{key}")
# Slight hack since freeze_time doens't work on redis
expect($redis.pttl("chat_integration:transcript:#{key}")).to be <= (3601*1000)
expect($redis.pttl("chat_integration:transcript:#{key}")).to be >= (3599*1000)
end
end