diff options
author | Jon Leighton <j@jonathanleighton.com> | 2010-12-12 17:03:41 +0000 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2010-12-16 01:49:30 +0530 |
commit | 491ce5b6ce1a3af42d02efff9a2e42b1a8980553 (patch) | |
tree | f6426bd1640273d10ee2bd8ce6db177c00da97bc /activerecord/test/cases/associations | |
parent | eba76640862d071d89c846f8624d1e651d872794 (diff) | |
download | rails-491ce5b6ce1a3af42d02efff9a2e42b1a8980553.tar.gz rails-491ce5b6ce1a3af42d02efff9a2e42b1a8980553.tar.bz2 rails-491ce5b6ce1a3af42d02efff9a2e42b1a8980553.zip |
Verify that creating a has_many through record where there is a default_scope on the join model works correctly (creates the join record with the default scope applied)
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 113d0f6d73..44ff01ddc0 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -17,6 +17,8 @@ require 'models/developer' require 'models/subscriber' require 'models/book' require 'models/subscription' +require 'models/categorization' +require 'models/category' class HasManyThroughAssociationsTest < ActiveRecord::TestCase fixtures :posts, :readers, :people, :comments, :authors, @@ -466,4 +468,9 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase def test_has_many_through_with_default_scope_on_join_model assert_equal posts(:welcome).comments, authors(:david).comments_on_first_posts end + + def test_create_has_many_through_with_default_scope_on_join_model + category = authors(:david).special_categories.create(:name => "Foo") + assert_equal 1, category.categorizations.where(:special => true).count + end end |