diff options
author | Tobias Lütke <tobias.luetke@gmail.com> | 2005-12-20 21:20:35 +0000 |
---|---|---|
committer | Tobias Lütke <tobias.luetke@gmail.com> | 2005-12-20 21:20:35 +0000 |
commit | 90099e9dc287d46178581d6b09d8b42a0a302a04 (patch) | |
tree | d58f41dcc9eef3c54c0ff76bf8f131b6898c2d1d /activerecord/test | |
parent | d5441b2d506b4286e92746abd8c919e4ce10380e (diff) | |
download | rails-90099e9dc287d46178581d6b09d8b42a0a302a04.tar.gz rails-90099e9dc287d46178581d6b09d8b42a0a302a04.tar.bz2 rails-90099e9dc287d46178581d6b09d8b42a0a302a04.zip |
made .find() and class method delegation work on :through relations
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3325 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/associations_join_model_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/associations_join_model_test.rb b/activerecord/test/associations_join_model_test.rb index 502e4d28c5..f385bd2175 100644 --- a/activerecord/test/associations_join_model_test.rb +++ b/activerecord/test/associations_join_model_test.rb @@ -42,5 +42,23 @@ class AssociationsJoinModelTest < Test::Unit::TestCase def test_has_many_with_piggyback assert_equal "2", categories(:sti_test).authors.first.post_id end + + def test_has_many_find_all + assert_equal [categories(:general)], authors(:david).categories.find(:all) + end + + def test_has_many_find_first + assert_equal categories(:general), authors(:david).categories.find(:first) + end + + def test_has_many_find_conditions + assert_equal categories(:general), authors(:david).categories.find(:first, :conditions => "categories.name = 'General'") + assert_equal nil, authors(:david).categories.find(:first, :conditions => "categories.name = 'Technology'") + end + + def test_has_many_class_methods_called_by_method_missing + assert_equal categories(:general), authors(:david).categories.find_by_name('General') +# assert_equal nil, authors(:david).categories.find_by_name('Technology') + end end |