Sha256: 8d2215250f83ea28432c656722742054e6b7d0dd09fa0e76442d9fdffd051b64
Contents?: true
Size: 1.85 KB
Versions: 2
Compression:
Stored size: 1.85 KB
Contents
require 'spec_helper' describe Hawkei::Store do subject(:store) { Hawkei::Store } describe '.store' do it { expect(store.store).to eq({})} end describe '.store' do before { store.clear! } it { expect(store.store).to eq({})} context 'with values' do before { store.set(:test, 'value') } before { store.clear! } it { expect(store.store).to eq({}) } end end describe '.load_from_hash' do context 'with hash' do before { store.load_from_hash('test' => 'value', another: 'another_value') } it { expect(store.store).to match(test: 'value', another: 'another_value') } end it { expect { store.load_from_hash(nil) }.to_not raise_error } end describe '.set' do before { store.set(:test, 'value') } it { expect(store.store).to eq(test: 'value') } end describe '[]=' do before { store[:test] = 'value' } it { expect(store.store).to eq(test: 'value') } end describe '.get' do before { store.set(:test, 'value') } it { expect(store.get(:test)).to eq('value') } end describe '[]' do before { store[:test] = 'value' } it { expect(store[:test]).to eq('value') } end describe '.bulk_set' do before { store[:test] = 'value' } before { store.bulk_set(new_test: 'value', another: 'another_value') } it { expect(store.store).to match(test: 'value', new_test: 'value', another: 'another_value') } end describe '.exist?' do before { store.set(:test, 'value') } it { expect(store.exist?(:test)).to be_truthy } it { expect(store.exist?(:something)).to be_falsey } end describe '.exist?' do before { store.set(:test, 'value') } before { store.delete(:test)} it { expect(store.exist?(:test)).to be_falsey } context 'value does not exist' do it { expect { store.delete(:something) }.to_not raise_error } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hawkei-1.1.0 | spec/lib/hawkei/store_spec.rb |
hawkei-1.0.0 | spec/lib/hawkei/store_spec.rb |