Sha256: e584e4e129ffad0ecf0916e2654b2c757f040eb5ae72cdec72e630945ad4f5b5

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__), 'lib')

require 'test/unit'

require 'og'
require 'og/relation'

class TestCaseOgRelation < Test::Unit::TestCase # :nodoc: all
	include Og

	class User
		property :name
		has_many Dummer
		has_many Article
	end
	
	class Article
		property :body, String
	end
	
	def test_all
		# no-namespace case.
		rel = User.relation(:dummers)
		rel.resolve_target
		assert_equal Dummer, rel.target_class	
	
		# namespace case.
		rel = User.relation(:articles)
		rel.resolve_target
		assert_equal TestCaseOgRelation::Article, rel.target_class		
		
		# bug: test the no belongs_to case in Article
		
		og = Og.setup(:store => :memory, :name => 'test')
		og.manage_classes
		
	end
end

class Dummer
	property :dum, String
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
og-0.20.0 test/og/tc_relation.rb