diff options
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/serializers/xml_serialization_test.rb | 4 | ||||
-rw-r--r-- | activemodel/test/cases/validations_test.rb | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/activemodel/test/cases/serializers/xml_serialization_test.rb b/activemodel/test/cases/serializers/xml_serialization_test.rb index 73f316d5e0..5db14c8157 100644 --- a/activemodel/test/cases/serializers/xml_serialization_test.rb +++ b/activemodel/test/cases/serializers/xml_serialization_test.rb @@ -118,10 +118,10 @@ class XmlSerializationTest < ActiveModel::TestCase end test "should include yielded additions" do - xml = @contact.to_xml do |xml| + xml_output = @contact.to_xml do |xml| xml.creator "David" end - assert_match %r{<creator>David</creator>}, xml + assert_match %r{<creator>David</creator>}, xml_output end test "should serialize string" do diff --git a/activemodel/test/cases/validations_test.rb b/activemodel/test/cases/validations_test.rb index 4ea5670d32..6a74ee353d 100644 --- a/activemodel/test/cases/validations_test.rb +++ b/activemodel/test/cases/validations_test.rb @@ -295,6 +295,15 @@ class ValidationsTest < ActiveModel::TestCase assert auto.valid? end + def test_validate + auto = Automobile.new + + assert_empty auto.errors + + auto.validate + assert_not_empty auto.errors + end + def test_strict_validation_in_validates Topic.validates :title, strict: true, presence: true assert_raises ActiveModel::StrictValidationFailed do |