diff options
Diffstat (limited to 'activemodel/test/cases/errors_test.rb')
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index 8ddedb160a..e2dea12589 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -27,6 +27,13 @@ class ErrorsTest < ActiveModel::TestCase end end + def test_delete + errors = ActiveModel::Errors.new(self) + errors[:foo] = 'omg' + errors.delete(:foo) + assert errors[:foo].empty? + end + def test_include? errors = ActiveModel::Errors.new(self) errors[:foo] = 'omg' @@ -39,6 +46,14 @@ class ErrorsTest < ActiveModel::TestCase assert errors.has_key?(:foo), 'errors should have key :foo' end + def test_dup + errors = ActiveModel::Errors.new(self) + errors[:foo] = 'bar' + errors_dup = errors.dup + errors_dup[:bar] = 'omg' + assert_not_same errors_dup.messages, errors.messages + end + test "should return true if no errors" do person = Person.new person.errors[:foo] |