Verify that there is no unwanted implicit readonly set on Model.has_many_through.find(id) [#5442 state:resolved]
This commit is contained in:
parent
fb3a8c51b4
commit
6974c595fd
@ -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 @@ def test_has_many_with_through_is_not_implicitly_marked_readonly
|
||||
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?
|
||||
|
Loading…
Reference in New Issue
Block a user