Sha256: 52643ca4550d9d08f98ff63d5af8fe942ae7998145c4b3fe1fbb1afed441febd
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
require File.join(File.dirname(__FILE__), 'CONFIG.rb') $DBG = true require 'test/unit' require 'og' class TC_Join < Test::Unit::TestCase # :nodoc: all include Og class Category property :title, String def initialize(title) @title = title end end class Article property :title, String joins_many Category, :through => ArticleToCategory def initialize(title) @title = title end end class ArticleToCategory property :rate, Float property :hits, Fixnum has_one Article has_one Category end def setup @og = Og.setup($og_config) end def test_all c1 = Category.create('tech') c2 = Category.create('funny') a = Article.create('a1') a.categories.push(c1, :hits =>3, :rate => 2.3) a.categories.push(c2, :rate => 1.2) join = a.category_join_data(c1) assert_equal 2.3, join.rate assert_equal 3, join.hits join = a.category_join_data(c2) assert_equal 1.2, join.rate assert_equal nil, join.hits end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
og-0.24.0 | test/og/tc_join.rb |
og-0.25.0 | test/og/tc_join.rb |
og-0.26.0 | test/og/tc_join.rb |