diff options
author | kuahyeow <kuahyeow@gmail.com> | 2012-03-07 22:54:46 +1300 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2012-03-08 09:49:21 +1300 |
commit | 9bcd6622dde4896b54fc0e1f843c624771e3e425 (patch) | |
tree | 4c2e80dc202d97363ebdf2b3783be0a3c1b1d04a /activerecord | |
parent | 524e8a1a802d773f59cb6bb6466c8f6486084340 (diff) | |
download | rails-9bcd6622dde4896b54fc0e1f843c624771e3e425.tar.gz rails-9bcd6622dde4896b54fc0e1f843c624771e3e425.tar.bz2 rails-9bcd6622dde4896b54fc0e1f843c624771e3e425.zip |
Add tests to test that through associations are not readonly, and we can update the records we retrive from the association
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 11 |
1 files changed, 11 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 c7bc275cf6..6836a2b4d0 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -688,6 +688,17 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase assert author.comments.include?(comment) end + def test_through_association_readonly_should_be_false + assert !people(:michael).posts.first.readonly? + assert !people(:michael).posts.all.first.readonly? + end + + def test_can_update_through_association + assert_nothing_raised do + people(:michael).posts.first.update_attributes!(:title => "Can write") + end + end + def test_has_many_through_polymorphic_with_primary_key_option assert_equal [categories(:general)], authors(:david).essay_categories |