aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/readonly_test.rb
diff options
context:
space:
mode:
authoroleg dashevskii <be9@be9.ru>2010-08-26 11:22:27 +0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-23 15:19:18 -0800
commit6974c595fd480dc0ae3311ef60920fa87c5ff9d0 (patch)
tree96a95f823300feaf6dbf76ca285e78dadf871b9c /activerecord/test/cases/readonly_test.rb
parentfb3a8c51b4028e8d122fdbb783d73d0ed37ca168 (diff)
downloadrails-6974c595fd480dc0ae3311ef60920fa87c5ff9d0.tar.gz
rails-6974c595fd480dc0ae3311ef60920fa87c5ff9d0.tar.bz2
rails-6974c595fd480dc0ae3311ef60920fa87c5ff9d0.zip
Verify that there is no unwanted implicit readonly set on Model.has_many_through.find(id) [#5442 state:resolved]
Diffstat (limited to 'activerecord/test/cases/readonly_test.rb')
-rw-r--r--activerecord/test/cases/readonly_test.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/activerecord/test/cases/readonly_test.rb b/activerecord/test/cases/readonly_test.rb
index 98011f40a4..a1eb96ef09 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)
@@ -71,6 +71,18 @@ class ReadOnlyTest < ActiveRecord::TestCase
assert !people.any?(&:readonly?)
end
+ def test_has_many_with_through_is_not_implicitly_marked_readonly_while_finding_by_id
+ assert !posts(:welcome).people.find(1).readonly?
+ end
+
+ def test_has_many_with_through_is_not_implicitly_marked_readonly_while_finding_first
+ assert !posts(:welcome).people.first.readonly?
+ end
+
+ def test_has_many_with_through_is_not_implicitly_marked_readonly_while_finding_last
+ assert !posts(:welcome).people.last.readonly?
+ end
+
def test_readonly_scoping
Post.send(:with_scope, :find => { :conditions => '1=1' }) do
assert !Post.find(1).readonly?