Permalink
Browse files

Failing test for issue #1513

  • Loading branch information...
1 parent b23ac93 commit eb7eb0a73660c72b0627ba88a929b26814178f04 @markmcspadden committed May 18, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 activemodel/test/cases/validations_test.rb
@@ -120,6 +120,24 @@ def test_errors_empty_after_errors_on_check
assert t.errors.empty?
end
+ def test_errors_on_base_on_frozen_object
+ t = Topic.new
+ t.freeze
+ t.errors.add(:base, :invalid)
+ assert t.invalid?
+ assert_equal ["is invalid"], t.errors[:base]
+ assert_equal 1, t.errors.count
+ end
+
+ def test_errors_on_attribute_on_frozen_object
+ r = Reply.new
+ r.content = "Mismatch"
+ r.freeze
+ assert r.invalid?
+ assert_equal ["is Empty"], r.errors[:title]
+ assert_equal 1, r.errors.count
+ end
+
def test_validates_each
hits = 0
Topic.validates_each(:title, :content, [:title, :content]) do |record, attr|

0 comments on commit eb7eb0a

Please sign in to comment.