Sha256: cbf0c8392472a1f0eade2676dfd5693bc4e32e7c54519c76af9134f68f6f3c8f
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') require 'test/unit' require 'ostruct' require 'og' require 'og/adapters/sqlserver' if defined?(DBI) class TC_OgSqlserver < Test::Unit::TestCase # :nodoc: all # 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 => 'sqlserver', :address => 'localhost', :database => 'test', :user => 'sa', :password => 'sa', :connection_count => 2 } $DBG = true # Og::Database.drop_db!(config) @og = Og::Database.new(config) end def teardown @og.shutdown end def test_all puts Article.all.size Article.each {|a| a.delete! } puts Article.all.size a = Article.new('gmosx', 30) a.save! baseoid = a.oid a1 = Article[baseoid] assert_equal 'gmosx', a1.name assert_equal 30, a1.age assert_equal baseoid, 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['ekarak'] assert_equal 'ekarak', a3.name c1 = Comment.new('a comment') c1.save! a3.add_comment(c1) a5 = Article['ekarak'] assert_equal 1, a5.comments.size end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
og-0.16.0 | test/og/adapters/tc_sqlserver.rb |