Commit 78c6023fa1c1c046a503e3854255f574d12bce98

Transaction#head_version is implemented

Commit diff

lib/strokedb/transaction.rb

 
2626 storage.find(uuid,version,opts.merge(:store => self))
2727 end
2828
29 def head_version(uuid)
30 storage.head_version(uuid,{ :store => self })
31 end
32
2933 def save!(doc)
3034 @timestamp = @timestamp.next
3135 storage.save!(doc,@timestamp)
toggle raw diff

spec/lib/strokedb/stores/transaction_spec.rb

 
4747 end
4848 Document.find(@doc.uuid).should be_nil
4949 end
50
51 it "should see its own head version of the document" do
52 @doc = Document.create!
53 @txn.execute do |txn|
54 @doc.update_slots! :new_version => 'yes'
55 @doc.store.head_version(@doc.uuid).should == @doc.version
56 end
57 @doc.store.head_version(@doc.uuid).should == @doc.versions.previous.version
58 end
5059
5160 it "should be able to commit transaction" do
5261 @txn.execute do |txn|
toggle raw diff