Permalink
Browse files

Remove test for XML YAML parsing

The support for YAML parsing in XML has been removed from Active Support
since it introduced an security risk. See http://goo.gl/Dak4R for more
detail.
  • Loading branch information...
1 parent 00048f7 commit a058957576ee0d0aaf854260f88762f16fe29448 @sikachu sikachu committed Jan 9, 2013
Showing with 3 additions and 30 deletions.
  1. +1 −15 test/abstract_unit.rb
  2. +2 −15 test/cases/base_test.rb
View
@@ -81,34 +81,20 @@ def setup_response
:mother => {:name => 'Ingeborg'}
}
}.to_json
- # - resource with yaml array of strings; for ARs using serialize :bar, Array
- @marty = <<-eof.strip
- <?xml version=\"1.0\" encoding=\"UTF-8\"?>
- <person>
- <id type=\"integer\">5</id>
- <name>Marty</name>
- <colors type=\"yaml\">---
- - \"red\"
- - \"green\"
- - \"blue\"
- </colors>
- </person>
- eof
@startup_sound = {
:sound => {
:name => "Mac Startup Sound", :author => { :name => "Jim Reekes" }
}
}.to_json
-
+
@product = {id: 1, name: 'Rails book'}.to_json
@inventory = {status: 'Sold Out', total: 10, used: 10}.to_json
ActiveResource::HttpMock.respond_to do |mock|
mock.get "/people/1.json", {}, @matz
mock.get "/people/1.xml", {}, @matz_xml
mock.get "/people/2.xml", {}, @david
- mock.get "/people/5.xml", {}, @marty
mock.get "/people/Greg.json", {}, @greg
mock.get "/people/6.json", {}, @joe
mock.get "/people/4.json", { 'key' => 'value' }, nil, 404
View
@@ -672,7 +672,7 @@ def test_build_without_attributes_for_prefix_call
end
assert_raise(ActiveResource::InvalidRequestError) { StreetAddress.build }
end
-
+
def test_build_with_attributes_for_prefix_call
ActiveResource::HttpMock.respond_to do |mock|
mock.get "/people/1/addresses/new.json", {}, StreetAddress.new.to_json
@@ -1205,26 +1205,13 @@ def test_parse_resources_with_has_many_makes_get_request_on_nested_route
assert_kind_of Comment, comment
end
end
-
+
def test_parse_resource_with_has_one_makes_get_request_on_child_route
Product.send(:has_one, :inventory)
product = Product.find(1)
assert product.inventory.status == ActiveSupport::JSON.decode(@inventory)['status']
end
- def test_load_yaml_array
- assert_nothing_raised do
- Person.format = :xml
- marty = Person.find(5)
- assert_equal 3, marty.colors.size
- marty.colors.each do |color|
- assert_kind_of String, color
- end
- end
- ensure
- Person.format = :json
- end
-
def test_with_custom_formatter
addresses = [{ :id => "1", :street => "1 Infinite Loop", :city => "Cupertino", :state => "CA" }].to_xml(:root => :addresses)

0 comments on commit a058957

Please sign in to comment.