| | 92 | |
|---|
| | 93 | RESPONSE_CDATA = <<__XML__.chomp |
|---|
| | 94 | <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> |
|---|
| | 95 | <env:Body> |
|---|
| | 96 | <gno:getHealthSummaryResponse xmlns:gno='http://some.url'> |
|---|
| | 97 | <gno:htmlContent> |
|---|
| | 98 | <![CDATA[<span>some html</span>]]> |
|---|
| | 99 | </gno:htmlContent> |
|---|
| | 100 | </gno:getHealthSummaryResponse> |
|---|
| | 101 | </env:Body> |
|---|
| | 102 | </env:Envelope> |
|---|
| | 103 | __XML__ |
|---|
| | 104 | def test_cdata |
|---|
| | 105 | @client.return_response_as_xml = true |
|---|
| | 106 | @client.test_loopback_response << RESPONSE_CDATA |
|---|
| | 107 | xml = @client.hello(nil) |
|---|
| | 108 | assert_equal(RESPONSE_CDATA, xml) |
|---|
| | 109 | require 'rexml/document' |
|---|
| | 110 | doc = REXML::Document.new(xml) |
|---|
| | 111 | assert_equal("<span>some html</span>", |
|---|
| | 112 | REXML::XPath.match(doc, "//*[name()='gno:htmlContent']")[0][1].value) |
|---|
| | 113 | end |
|---|