Sha256: 029d8c67d943fc2b31592884c8605ab0e405d134a34ddaf607717d7c51383c74
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
require 'abstract_unit' class InvisibleModelAssocTest < Test::Unit::TestCase fixtures :fun_users, :groups, :group_memberships def setup @group = groups(:first) @user = fun_users(:first) @membership = group_memberships(:first_first) end def test_has_some assert_equal @membership, @user.group_membership assert_equal [@membership], @user.group_memberships assert_equal @membership, @group.group_membership assert_equal [@membership], @group.group_memberships end def test_belongs_to assert_equal @user, @membership.fun_user assert_equal @group, @membership.group GroupTag.find(:all, :conditions => ['group_id = ?', @group.id]).each do |group_tag| assert_equal @group, group_tag.group end end def test_indirect assert_equal [@user], @group.fun_users assert_equal [@group], @user.groups end # TODO - Support these #def test_more_indirect # group_tags = GroupTag.find(:all, :conditions => ['group_id = ?', @group.id]) # assert_equal group_tags, @user.group_tags #end #def test_more_indirect_via_belongs_to # @group_tag = group_tag(:first) # assert_equal [@user], @group_tag.fun_users #end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dr_nic_magic_models-0.7.0 | test/invisible_model_assoc_test.rb |
dr_nic_magic_models-0.7.1 | test/invisible_model_assoc_test.rb |