Sha256: c746a862e8f3c683d89aeb3d8bbc09c16b32ecd33ed313657802154128b16abf
Contents?: true
Size: 599 Bytes
Versions: 4
Compression:
Stored size: 599 Bytes
Contents
describe '#when' do before do class SelectionDocument include Yapper::Document field :field1 field :field2 end end before { Yapper::DB.instance.purge } after { Object.send(:remove_const, 'SelectionDocument') } describe 'when a document does not exist' do it 'only executes the block when the document exists' do doc = SelectionDocument.new(:field1 => 'field1') found = false SelectionDocument.when(doc.id) do |_doc| found = true end found.should == false doc.save found.should == true end end end
Version data entries
4 entries across 4 versions & 1 rubygems