Skip to content

Commit

Permalink
[operation/exist?] existence spec with temporal entries
Browse files Browse the repository at this point in the history
  • Loading branch information
0exp committed Sep 1, 2018
1 parent 528fa73 commit 8e1ad49
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/features/exist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
let(:expiration_time) { 8 } # NOTE: in seconds
let(:entry) { { key: SecureRandom.hex, value: SecureRandom.hex(4) } }

context 'entry with expiration time' do
before { cache_store.write(entry[:key], entry[:value], expires_in: expiration_time) }

specify 'returns corresponding value (exists => true, does not exist => false)' do
expect(cache_store.exist?(entry[:key])).to eq(true)

sleep(expiration_time + 1)

expect(cache_store.exist?(entry[:key])).to eq(false)
end
end

context 'when entry exists' do
before { cache_store.write(entry[:key], entry[:value]) }

Expand Down

0 comments on commit 8e1ad49

Please sign in to comment.