| | 67 | end |
|---|
| | 68 | |
|---|
| | 69 | def test_put_xml_using_a_type_node |
|---|
| | 70 | process('PUT', 'application/xml', '<type attributed="true"><summary>content...</summary></type>') |
|---|
| | 71 | |
|---|
| | 72 | assert_equal 'type', @controller.response.body |
|---|
| | 73 | assert @controller.params.has_key?(:type) |
|---|
| | 74 | assert_equal 'content...', @controller.params["type"]['summary'] |
|---|
| | 75 | assert_equal 'true', @controller.params["type"]['attributed'] |
|---|
| | 76 | end |
|---|
| | 77 | |
|---|
| | 78 | def test_put_xml_using_a_type_node_and_attribute |
|---|
| | 79 | process('PUT', 'application/xml', '<type attributed="true"><summary type="boolean">false</summary></type>') |
|---|
| | 80 | |
|---|
| | 81 | assert_equal 'type', @controller.response.body |
|---|
| | 82 | assert @controller.params.has_key?(:type) |
|---|
| | 83 | assert_equal false, @controller.params["type"]['summary'] |
|---|
| | 84 | assert_equal 'true', @controller.params["type"]['attributed'] |
|---|
| | 85 | end |
|---|
| | 86 | |
|---|
| | 87 | def test_post_xml_using_a_type_node |
|---|
| | 88 | process('POST', 'application/xml', '<font attributed="true"><type>arial</type></font>') |
|---|
| | 89 | |
|---|
| | 90 | assert_equal 'font', @controller.response.body |
|---|
| | 91 | assert @controller.params.has_key?(:font) |
|---|
| | 92 | assert_equal 'arial', @controller.params['font']['type'] |
|---|
| | 93 | assert_equal 'true', @controller.params["font"]['attributed'] |
|---|
| | 94 | end |
|---|
| | 95 | |
|---|
| | 96 | def test_post_xml_using_a_root_node_named_type |
|---|
| | 97 | process('POST', 'application/xml', '<type type="integer">33</type>') |
|---|
| | 98 | |
|---|
| | 99 | assert @controller.params.has_key?(:type) |
|---|
| | 100 | assert_equal 33, @controller.params['type'] |
|---|
| | 101 | end |
|---|
| | 102 | |
|---|
| | 103 | def test_post_xml_using_an_attributted_node_named_type |
|---|
| | 104 | ActionController::Base.param_parsers[Mime::XML] = Proc.new { |data| XmlSimple.xml_in(data, 'ForceArray' => false) } |
|---|
| | 105 | process('POST', 'application/xml', '<request><type type="string">Arial,12</type><z>3</z></request>') |
|---|
| | 106 | |
|---|
| | 107 | assert_equal 'type, z', @controller.response.body |
|---|
| | 108 | assert @controller.params.has_key?(:type) |
|---|
| | 109 | assert_equal 'string', @controller.params['type']['type'] |
|---|
| | 110 | assert_equal 'Arial,12', @controller.params['type']['content'] |
|---|
| | 111 | assert_equal '3', @controller.params['z'] |
|---|