Sha256: 08aab53e658c15052db86860b6dcba302236d4525b1fd9d957b95859207c6ad9
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
require File.dirname(__FILE__) + '/../test_helper' class UserTest < Test::Unit::TestCase fixtures :users, :groups, :user_groups def test_joinfix assert_equal "Administrators", users(:john_doe).groups.first.name assert_equal 2, User.find_by_full_name("Jane Doe").groups.count assert_equal 3, UserGroup.find(user_groups(:admin_group_jane_doe).id).group.id end def test_nested_joinfix assert_equal "Administrators Nested", users(:john_doe_n).groups.first.name assert_equal 2, User.find_by_full_name("Jane Doe Nested").groups.count assert_equal 30, UserGroup.find(user_groups(:admin_group_n_jane_doe_n).id).group.id end def test_associations active_record_class = User a = active_record_class.reflect_on_association(:groups) assert_equal :has_many, a.macro assert_equal({:through => :user_groups}, a.options ) assert_equal User.reflect_on_association(:user_groups), a.through_reflection assert_equal UserGroup.reflect_on_association(:group), a.source_reflection assert_equal "user_groups", a.through_reflection.table_name assert_equal "user_id", a.through_reflection.primary_key_name assert_equal "groups", a.source_reflection.table_name assert_equal "group_id", a.source_reflection.primary_key_name end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
joinfix-1.0.0 | rails/test/unit/user_test.rb |
joinfix-1.0.1 | rails/test/unit/user_test.rb |