Sha256: 501f598ad05eb6bc08b3d8fa31182be4f8344b9476c9b915e75059c0bd64ef89
Contents?: true
Size: 1.38 KB
Versions: 30
Compression:
Stored size: 1.38 KB
Contents
require 'spec_helper' describe Picky::Backends::SQLite::DirectlyManipulable do let(:client) { double :client } let(:backend) { double :backend, client: client, namespace: 'some:namespace' } let(:array) do array = [1,2] described_class.make backend, array, 'some:key' array end context 'stubbed backend' do before(:each) do backend.stub :[] end it 'calls the right client method' do backend.should_receive(:[]=).once.with 'some:key', [1,2,3] array << 3 end it 'calls the right client method' do backend.should_receive(:[]=).once.with 'some:key', [3,1,2] array.unshift 3 end it 'calls the right client method' do backend.should_receive(:[]=).once.with 'some:key', [2] array.delete 1 end it 'calls the right client method' do client.should_receive(:zrem).never array.delete 5 end end context 'stubbed client/backend' do before(:each) do backend.stub :[]= end it 'behaves like an ordinary Array' do array << 3 array.should == [1,2,3] end it 'behaves like an ordinary Array' do array.unshift 3 array.should == [3,1,2] end it 'behaves like an ordinary Array' do array.delete 1 array.should == [2] end it 'behaves like an ordinary Array' do array.delete 5 array.should == [1,2] end end end
Version data entries
30 entries across 30 versions & 1 rubygems