require 'spec_helper' describe Jamnagar::Storage::ItemStore do context 'inserting records' do it 'should ignore nil records' do sut = Jamnagar::Storage::ItemStore.new expect(lambda{ sut.insert(nil) }).to_not raise_exception end it 'should insert records using a primary key and value' do sut = Jamnagar::Storage::ItemStore.new sut.insert({"_id" => 1, "url" => "http://example.com"}) end it 'should raise an exception if the primary key is missing' do sut = Jamnagar::Storage::ItemStore.new expect(lambda{ sut.insert({}) }).to raise_exception Jamnagar::Storage::ItemStore::MissingPrimaryKeyException end end end