-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathrender_spec.rb
More file actions
49 lines (42 loc) · 1.82 KB
/
Copy pathrender_spec.rb
File metadata and controls
49 lines (42 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'spec_helper'
describe "Request" do
def app
SoapApp
end
it "should render xml with params" do
headers = {"HTTP_SOAPACTION" => 'test_render'}
message = '<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="any" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><wsdl:test></wsdl:test></env:Body></env:Envelope>'
post '/action', message, headers
response = %{
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<soap:TestRenderReply>
<top>
<child attr1="attr_value">
<value>content</value>
</child>
</top>
</soap:TestRenderReply>
</soap:Body>
</soap:Envelope>}.strip
expect(last_response.body).to eq(response + "\n")
end
it "should render xml with params and single content" do
headers = {"HTTP_SOAPACTION" => 'test_render2'}
message = '<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="any" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><wsdl:test></wsdl:test></env:Body></env:Envelope>'
post '/action', message, headers
response = %{
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<soap:test_render2Response>
<result status="success">
<foo active="true">bar</foo>
</result>
</soap:test_render2Response>
</soap:Body>
</soap:Envelope>}.strip
expect(last_response.body).to eq(response + "\n")
end
end