Sha256: ea0fd1e128b7c8b0060052a72a84e11e9443cf8fc29630efc3464e1bdbc5b2d7
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
require 'minitest_helper' describe Caching::Storage do it 'Write and Read' do storage = Caching::Storage.new storage.write :key_1, 'value_1' storage.write :key_2, 'value_2' storage.read(:key_1).must_equal 'value_1' storage.read(:key_2).must_equal 'value_2' end it 'Fetch' do storage = Caching::Storage.new number = 0 storage.fetch(:key) { number += 1 }.must_equal 1 storage.fetch(:key) { number += 1 }.must_equal 1 number.must_equal 1 end it 'Clear all' do storage = Caching::Storage.new storage.write :key_1, 'value_1' storage.write :key_2, 'value_2' storage.clear storage.read(:key_1).must_be_nil storage.read(:key_2).must_be_nil end it 'Clear specific keys' do storage = Caching::Storage.new storage.write :key_1, 'value_1' storage.write :key_2, 'value_2' storage.write :key_3, 'value_3' storage.clear :key_1, :key_3 storage.read(:key_1).must_be_nil storage.read(:key_2).must_equal 'value_2' storage.read(:key_3).must_be_nil end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
caching-0.0.5 | spec/storage_spec.rb |
caching-0.0.4 | spec/storage_spec.rb |
caching-0.0.3 | spec/storage_spec.rb |
caching-0.0.2 | spec/storage_spec.rb |
caching-0.0.1 | spec/storage_spec.rb |