diff options
author | Marcel Molina <marcel@vernix.org> | 2006-04-29 23:00:47 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2006-04-29 23:00:47 +0000 |
commit | 3fec943aca9ab73bf00d5dffa3f73452f33bab88 (patch) | |
tree | cd708510c8be8951440580f6a233674b8066e6bf /activerecord/test | |
parent | aa72c465ec4aa641e9ea161110a43ad9c02d167b (diff) | |
download | rails-3fec943aca9ab73bf00d5dffa3f73452f33bab88.tar.gz rails-3fec943aca9ab73bf00d5dffa3f73452f33bab88.tar.bz2 rails-3fec943aca9ab73bf00d5dffa3f73452f33bab88.zip |
Allow AR::Base#to_xml to include methods too. Closes #4921. [johan@textdrive.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4314 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/base_test.rb | 6 | ||||
-rwxr-xr-x | activerecord/test/fixtures/company.rb | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 2f834772a6..4ccc2c8588 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -1273,6 +1273,12 @@ class BasicsTest < Test::Unit::TestCase assert xml.include?(%(<clients><client>)) end + def test_to_xml_including_methods + xml = Company.new.to_xml(:methods => :arbitrary_method, :skip_instruct => true) + assert_equal "<company>", xml.first(9) + assert xml.include?(%(<arbitrary-method>I am Jack's profound disappointment</arbitrary-method>)) + end + def test_except_attributes assert_equal( %w( author_name type id approved replies_count bonus_time written_on content author_email_address parent_id last_read), diff --git a/activerecord/test/fixtures/company.rb b/activerecord/test/fixtures/company.rb index 526748784e..250deebb21 100755 --- a/activerecord/test/fixtures/company.rb +++ b/activerecord/test/fixtures/company.rb @@ -5,6 +5,10 @@ class Company < ActiveRecord::Base validates_presence_of :name has_one :dummy_account, :foreign_key => "firm_id", :class_name => "Account" + + def arbitrary_method + "I am Jack's profound disappointment" + end end |