Permalink
Browse files

loaded relations cannot be mutated by extending!

  • Loading branch information...
1 parent c6f47c1 commit 35ca953a27124bd6dcd7aef8a62ffa27ccab83f1 @xuanxu xuanxu committed Sep 24, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 activerecord/test/cases/relations_test.rb
@@ -1391,6 +1391,15 @@ def test_presence
end
end
+ test "loaded relations cannot be mutated by extending!" do
+ relation = Post.all
+ relation.to_a
+
+ assert_raises(ActiveRecord::ImmutableRelation) do
+ relation.extending! Module.new
+ end
+ end
+
test "relations show the records in #inspect" do
relation = Post.limit(2)
assert_equal "#<ActiveRecord::Relation [#{Post.limit(2).map(&:inspect).join(', ')}]>", relation.inspect

0 comments on commit 35ca953

Please sign in to comment.