Sha256: ad890c26ebdf5b18126004d154441eaae06c5563613fd5f70aca7e828f65cfd4
Contents?: true
Size: 665 Bytes
Versions: 1
Compression:
Stored size: 665 Bytes
Contents
require File.expand_path("test_helper", File.dirname(__FILE__)) class Post < Ohm::Model attribute :title list :categories, Category end class Category < Ohm::Model attribute :name set :posts, Post end class CircularReferenceTest < Test::Unit::TestCase setup do @post = Post.create(:title => "New post") @category = Category.create(:name => "Ruby") end test "inspect" do @post.categories << @category @category.posts << @post assert_equal %Q{#<Post:1 title="New post" categories=#<List (Category): ["1"]>>}, @post.inspect assert_equal %Q{#<Category:1 name="Ruby" posts=#<Set (Post): ["1"]>>}, @category.inspect end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ohm-0.0.38 | test/circular_reference_test.rb |