Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update xml serialization tests to reflect a change in builder

Due to a change in builder, nil values now generates closed tags,
so instead of this:

    <pseudonyms nil=\"true\"></pseudonyms>

It generates this:

    <pseudonyms nil=\"true\"/>

Document this change in Rails so that people can track it down easily if
necessary.

Changes in Active Model, Active Record and Active Support tests.

Cherry-pick of d65adc7, 77dd3be and 146eaf3. Fix build.
  • Loading branch information...
commit 9fc6c31e38845e9008b72fa96b5a9f7b2d66982d 1 parent 61776f5
@carlosantoniodasilva carlosantoniodasilva authored
View
12 activemodel/CHANGELOG.md
@@ -1,3 +1,15 @@
+## Rails 3.1.9 (unreleased) ##
+
+* Due to a change in builder, nil values now generates closed tags, so instead of this:
+
+ <pseudonyms nil=\"true\"></pseudonyms>
+
+ It generates this:
+
+ <pseudonyms nil=\"true\"/>
+
+ *Carlos Antonio da Silva*
+
## Rails 3.1.8 (Aug 9, 2012)
* No changes.
View
2  activemodel/test/cases/serializers/xml_serialization_test.rb
@@ -94,7 +94,7 @@ def setup
end
test "should serialize nil" do
- assert_match %r{<pseudonyms nil=\"true\"></pseudonyms>}, @contact.to_xml(:methods => :pseudonyms)
+ assert_match %r{<pseudonyms nil=\"true\"/>}, @contact.to_xml(:methods => :pseudonyms)
end
test "should serialize integer" do
View
12 activerecord/test/cases/xml_serialization_test.rb
@@ -110,18 +110,18 @@ def setup
end
def test_should_serialize_string
- assert_match %r{<name nil="true"></name>}, @xml
+ assert_match %r{<name nil="true"/>}, @xml
end
def test_should_serialize_integer
- assert %r{<age (.*)></age>}.match(@xml)
+ assert %r{<age (.*)/>}.match(@xml)
attributes = $1
assert_match %r{nil="true"}, attributes
assert_match %r{type="integer"}, attributes
end
def test_should_serialize_binary
- assert %r{<avatar (.*)></avatar>}.match(@xml)
+ assert %r{<avatar (.*)/>}.match(@xml)
attributes = $1
assert_match %r{type="binary"}, attributes
assert_match %r{encoding="base64"}, attributes
@@ -129,21 +129,21 @@ def test_should_serialize_binary
end
def test_should_serialize_datetime
- assert %r{<created-at (.*)></created-at>}.match(@xml)
+ assert %r{<created-at (.*)/>}.match(@xml)
attributes = $1
assert_match %r{nil="true"}, attributes
assert_match %r{type="datetime"}, attributes
end
def test_should_serialize_boolean
- assert %r{<awesome (.*)></awesome>}.match(@xml)
+ assert %r{<awesome (.*)/>}.match(@xml)
attributes = $1
assert_match %r{type="boolean"}, attributes
assert_match %r{nil="true"}, attributes
end
def test_should_serialize_yaml
- assert_match %r{<preferences nil=\"true\"></preferences>}, @xml
+ assert_match %r{<preferences nil=\"true\"/>}, @xml
end
end
View
4 activesupport/test/core_ext/hash_ext_test.rb
@@ -611,7 +611,7 @@ def test_one_level_with_nils
assert_equal "<person>", xml.first(8)
assert xml.include?(%(<street>Paulina</street>))
assert xml.include?(%(<name>David</name>))
- assert xml.include?(%(<age nil="true"></age>))
+ assert xml.include?(%(<age nil="true"/>))
end
def test_one_level_with_skipping_types
@@ -619,7 +619,7 @@ def test_one_level_with_skipping_types
assert_equal "<person>", xml.first(8)
assert xml.include?(%(<street>Paulina</street>))
assert xml.include?(%(<name>David</name>))
- assert xml.include?(%(<age nil="true"></age>))
+ assert xml.include?(%(<age nil="true"/>))
end
def test_one_level_with_yielding
Please sign in to comment.
Something went wrong with that request. Please try again.