$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') =begin require 'test/unit' require 'ostruct' require 'og' require 'og/adapters/sqlite' class TC_OgSqlite3 < Test::Unit::TestCase # :nodoc: all include N # Forward declaration. class Comment; end class Article prop_accessor :name, String prop_accessor :age, Fixnum has_many :comments, Comment def initialize (name = nil, age = nil) @name, @age = name, age end end class Comment prop_accessor :text, String belongs_to :article, Article def initialize(text = nil) @text = text end end def setup config = { :adapter => 'sqlite', :database => 'test', :connection_count => 2 } $DBG = true Og::Database.drop_db!(config) @og = Og::Database.new(config) end def teardown @og.shutdown end def test_all a = Article.new('gmosx', 30) a.save! a1 = Article[1] assert_equal 'gmosx', a1.name assert_equal 30, a1.age assert_equal 1, a1.oid Article.create('drak', 12) Article.create('ekarak', 34) Article.create('mario', 53) Article.create('elathan', 34) articles = Article.all assert_equal 5, articles.size a3 = Article[3] assert_equal 'ekarak', a3.name c1 = Comment.new('a comment') c1.save! a3.add_comment(c1) a5 = Article[3] assert_equal 1, a5.comments.size end end =end