Calendar with CouchDB
Seems like I'll be heading to the OpenRheinRuhr this year, I just won a ticket for it!
This is a little preview of what we're going to be dealing with tomorrow:
require 'makura' Makura::Model.database = 'coulendar' class Event include Makura::Model properties :from, :to, :desc def from=(time) self['from'] = time.to_i end def from Time.at(self['from'].to_i) end def to=(time) self['to'] = time.to_i end def to Time.at(self['to'].to_i) end end require 'bacon' Bacon.summary_on_exit describe Event do before do Event.database = 'coulendar-test' Event.database.destroy! # clean up Event.database = 'coulendar-test' end it 'has a description' do desc = 'Writing blog post' from = Time.local(2011, 10, 25, 23) to = Time.local(2011, 10, 25, 24) event = Event.new(from: from, to: to, desc: desc) event.save event.desc.should == 'Writing blog post' event.from.hour.should == 23 end end