Sha256: cfba20ba27d46d99699d1b01ff92f9bea72f1b02ab84256237e7c4681f99ab84
Contents?: true
Size: 737 Bytes
Versions: 3
Compression:
Stored size: 737 Bytes
Contents
require './abstract_unit' class TestPolymorphic < ActiveSupport::TestCase fixtures :users, :employees, :comments, :hacks def test_polymorphic_has_many comments = Hack.find('andrew').comments assert_equal 'andrew', comments[0].person_id end def test_polymorphic_has_one first_comment = Hack.find('andrew').first_comment assert_equal 'andrew', first_comment.person_id end def test_has_many_through user = users(:santiago) article_names = user.articles.collect { |a| a.name }.sort assert_equal ['Article One', 'Article Two'], article_names end def test_polymorphic_has_many_through user = users(:santiago) assert_equal(['andrew'], user.hacks.collect { |a| a.name }.sort) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
composite_primary_keys-4.0.0 | test/test_polymorphic.rb |
composite_primary_keys-4.0.0.beta9 | test/test_polymorphic.rb |
composite_primary_keys-4.0.0.beta8 | test/test_polymorphic.rb |