aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/base_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-06-04 00:33:52 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-06-04 00:33:52 +0000
commit2e65e8ccc68c56607fb86f6668d4f886165ace5e (patch)
treec402f1a4e8eb66493ba0471124dba9cd4c2d02f2 /activerecord/test/base_test.rb
parent15b022a74fed4264a24da78566ebaaff29df29eb (diff)
downloadrails-2e65e8ccc68c56607fb86f6668d4f886165ace5e.tar.gz
rails-2e65e8ccc68c56607fb86f6668d4f886165ace5e.tar.bz2
rails-2e65e8ccc68c56607fb86f6668d4f886165ace5e.zip
Refactored ActiveRecord::Base.to_xml to become a delegate for XmlSerializer, which restores sanity to the mega method. This refactoring also reinstates the opinions that type="string" is redundant and ugly and nil-differentiation is not a concern of serialization [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4431 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/base_test.rb')
-rwxr-xr-xactiverecord/test/base_test.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index e13a6b81c6..44b7aea942 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -1225,14 +1225,14 @@ class BasicsTest < Test::Unit::TestCase
written_on_in_current_timezone = topics(:first).written_on.xmlschema
last_read_in_current_timezone = topics(:first).last_read.xmlschema
assert_equal "<topic>", xml.first(7)
- assert xml.include?(%(<title type="string">The First Topic</title>))
- assert xml.include?(%(<author-name type="string">David</author-name>))
+ assert xml.include?(%(<title>The First Topic</title>))
+ assert xml.include?(%(<author-name>David</author-name>))
assert xml.include?(%(<id type="integer">1</id>))
assert xml.include?(%(<replies-count type="integer">1</replies-count>))
assert xml.include?(%(<written-on type="datetime">#{written_on_in_current_timezone}</written-on>))
- assert xml.include?(%(<content type="string">Have a nice day</content>))
- assert xml.include?(%(<author-email-address type="string">david@loudthinking.com</author-email-address>))
- assert xml.match(%r{<parent-id (type="integer"\s*|nil="true"\s*){2}/>})
+ assert xml.include?(%(<content>Have a nice day</content>))
+ assert xml.include?(%(<author-email-address>david@loudthinking.com</author-email-address>))
+ assert xml.match(%(<parent-id type="integer"></parent-id>))
if current_adapter?(:SybaseAdapter) or current_adapter?(:SQLServerAdapter)
assert xml.include?(%(<last-read type="datetime">#{last_read_in_current_timezone}</last-read>))
else
@@ -1248,19 +1248,19 @@ class BasicsTest < Test::Unit::TestCase
def test_to_xml_skipping_attributes
xml = topics(:first).to_xml(:indent => 0, :skip_instruct => true, :except => :title)
assert_equal "<topic>", xml.first(7)
- assert !xml.include?(%(<title type="string">The First Topic</title>))
- assert xml.include?(%(<author-name type="string">David</author-name>))
+ assert !xml.include?(%(<title>The First Topic</title>))
+ assert xml.include?(%(<author-name>David</author-name>))
xml = topics(:first).to_xml(:indent => 0, :skip_instruct => true, :except => [ :title, :author_name ])
- assert !xml.include?(%(<title type="string">The First Topic</title>))
- assert !xml.include?(%(<author-name type="string">David</author-name>))
+ assert !xml.include?(%(<title>The First Topic</title>))
+ assert !xml.include?(%(<author-name>David</author-name>))
end
def test_to_xml_including_has_many_association
xml = topics(:first).to_xml(:indent => 0, :skip_instruct => true, :include => :replies)
assert_equal "<topic>", xml.first(7)
assert xml.include?(%(<replies><reply>))
- assert xml.include?(%(<title type="string">The Second Topic's of the day</title>))
+ assert xml.include?(%(<title>The Second Topic's of the day</title>))
end
def test_to_xml_including_belongs_to_association
@@ -1285,7 +1285,7 @@ class BasicsTest < Test::Unit::TestCase
)
assert_equal "<firm>", xml.first(6)
- assert xml.include?(%(<client><name type="string">Summit</name></client>))
+ assert xml.include?(%(<client><name>Summit</name></client>))
assert xml.include?(%(<clients><client>))
end