Sha256: 2a10a333d811ab4c33feb30f42a648a1038e67766cf382a2282abd76506df026
Contents?: true
Size: 738 Bytes
Versions: 40
Compression:
Stored size: 738 Bytes
Contents
require File.expand_path('../abstract_unit', __FILE__) class TestPolymorphic < ActiveSupport::TestCase fixtures :users, :employees, :comments, :hacks def test_polymorphic_has_many comments = Hack.find(7).comments assert_equal 7, comments[0].person_id end def test_polymorphic_has_one first_comment = Hack.find(7).first_comment assert_equal 7, 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
40 entries across 40 versions & 1 rubygems