Skip to content

Commit

Permalink
Add tests to test that through associations are not readonly, and we …
Browse files Browse the repository at this point in the history
…can update the records we retrive from the association
  • Loading branch information
kuahyeow authored and NZKoz committed Mar 7, 2012
1 parent 89cef07 commit a149612
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -688,6 +688,17 @@ def test_include_method_in_association_through_should_return_true_for_instance_a
assert author.comments.include?(comment) assert author.comments.include?(comment)
end 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 def test_has_many_through_polymorphic_with_primary_key_option
assert_equal [categories(:general)], authors(:david).essay_categories assert_equal [categories(:general)], authors(:david).essay_categories


Expand Down

0 comments on commit a149612

Please sign in to comment.