Sha256: 5519d6772b11451d9ce0f8052210aac5fba6ac856953d54ae4f0dd031951f1a0

Contents?: true

Size: 714 Bytes

Versions: 2

Compression:

Stored size: 714 Bytes

Contents

require File.join(File.dirname(__FILE__), 'CONFIG.rb')

require 'rubygems'
require 'facets'

require 'test/unit'
require 'og'
require 'glue/timestamped'

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

  class Category
    attr_accessor :name, String
  end
  
  class User
    attr_accessor :name, String
    joins_many Category

    def initialize name
      @name = name
    end
  end

  $og1.manage_classes(User, Category)

  def test_all
    c1 = Category.create_with :name => 'one'
    c2 = Category.create_with :name => 'two'
    
    u = User.new 'gmosx'
    u.categories << c1
    u.categories << c2
    u.save
    
    g = User[1]
    assert_equal 2, g.categories.size
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
og-0.41.0 test/og/tc_build.rb
og-0.40.0 test/og/tc_build.rb