Sha256: a6d793ae1c58d28079118335397d18ddd75a12ab5b4710ec1c343e330230893e
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 KB
Contents
require 'spec_helper' describe KueStore do it 'should have the kue_settings table correctly setup' do ActiveRecord::Base.connection.table_exists?(:kue_settings).should be_true end it 'should save a new key and value' do proc { KueStore[:key_one] = "Key One"}.should_not raise_error end it 'should retrieve a keys value' do KueStore[:key_two] = "Key Two" KueStore[:key_two].should == "Key Two" end it 'should save and retrieve complex objects' do proc { KueStore[:key_three] = Math }.should_not raise_error KueStore[:key_three].sqrt(100).should == 10 end it 'should check for existance' do KueStore.exists?(:non_existant).should be_false KueStore[:existant] = 109 KueStore.exists?(:existant).should be_true end it 'should delete a key and value' do KueStore[:delete_me] = 1098 KueStore.exists?(:delete_me).should be_true KueStore.delete!(:delete_me).should be_true KueStore.exists?(:delete_me).should be_false end it 'should not throw an error when deleting a key that does not exist' do proc { KueStore.delete!(:non_existant) }.should_not raise_error end it 'should list all keys' do KueStore[:k1] = 1 KueStore[:k2] = 2 KueStore[:k3] = 3 KueStore.keys.should == [:k1, :k2, :k3] end it 'should clear the store' do KueStore[:k1] = 1 KueStore[:k2] = 2 KueStore[:k3] = 3 KueStore.clear! KueStore.keys.should be_empty end it 'should count all items in the store' do KueStore[:k1] = 1 KueStore[:k2] = 2 KueStore[:k3] = 3 KueStore.count.should == 3 end end describe 'Using Kue::Store outside of the KueStore class - introducing BlueStore!' do class BlueStore < ActiveRecord::Base include Kue::Store end it 'should be able to be used as a kue store' do BlueStore[:ok] = "One" BlueStore[:ok].should == "One" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kue-0.0.7 | spec/kue_spec.rb |