From 8b8173968126f9b3ee7eabbc6d8cde8ab47c1557 Mon Sep 17 00:00:00 2001 From: oleg dashevskii Date: Wed, 25 Aug 2010 16:11:00 +0700 Subject: [PATCH] Test for #5442 --- activerecord/test/cases/readonly_test.rb | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/activerecord/test/cases/readonly_test.rb b/activerecord/test/cases/readonly_test.rb index 98011f4..08893fd 100644 --- a/activerecord/test/cases/readonly_test.rb +++ b/activerecord/test/cases/readonly_test.rb @@ -12,7 +12,7 @@ def Project.foo() find :first end class ReadOnlyTest < ActiveRecord::TestCase - fixtures :posts, :comments, :developers, :projects, :developers_projects + fixtures :posts, :comments, :developers, :projects, :developers_projects, :people, :readers def test_cant_save_readonly_record dev = Developer.find(1) @@ -68,9 +68,15 @@ class ReadOnlyTest < ActiveRecord::TestCase def test_has_many_with_through_is_not_implicitly_marked_readonly assert people = Post.find(1).people + assert !people.empty? assert !people.any?(&:readonly?) end + def test_has_many_with_through_is_not_implicitly_marked_readonly_while_finding_by_id + assert person = Post.find(1).people.find(1) + assert !person.readonly? + end + def test_readonly_scoping Post.send(:with_scope, :find => { :conditions => '1=1' }) do assert !Post.find(1).readonly? -- 1.7.0.4