savon 0.6.0 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +56 -0
- data/README.textile +39 -37
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/savon/client.rb +23 -5
- data/lib/savon/core_ext/string.rb +1 -1
- data/lib/savon/request.rb +6 -1
- data/lib/savon/response.rb +1 -1
- data/lib/savon/soap.rb +22 -8
- data/lib/savon/wsdl.rb +66 -36
- data/lib/savon/wsse.rb +6 -2
- data/spec/fixtures/user_fixture.rb +8 -4
- data/spec/http_stubs.rb +15 -17
- data/spec/savon/client_spec.rb +46 -47
- data/spec/savon/request_spec.rb +44 -64
- data/spec/savon/response_spec.rb +34 -51
- data/spec/savon/savon_spec.rb +13 -19
- data/spec/savon/soap_spec.rb +64 -89
- data/spec/savon/wsdl_spec.rb +19 -34
- data/spec/savon/wsse_spec.rb +48 -74
- data/spec/spec_helper.rb +1 -1
- data/spec/{spec_helper_methods.rb → spec_helper_classes.rb} +32 -4
- metadata +5 -4
data/spec/savon/wsdl_spec.rb
CHANGED
|
@@ -1,52 +1,37 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe Savon::WSDL do
|
|
4
|
-
before
|
|
5
|
-
|
|
6
|
-
def some_wsdl_instance
|
|
7
|
-
Savon::WSDL.new Savon::Request.new SpecHelper.some_endpoint
|
|
4
|
+
before do
|
|
5
|
+
@wsdl = Savon::WSDL.new Savon::Request.new(EndpointHelper.wsdl_endpoint)
|
|
8
6
|
end
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
some_wsdl_instance
|
|
13
|
-
end
|
|
8
|
+
it "is initialized with a Savon::Request object" do
|
|
9
|
+
Savon::WSDL.new Savon::Request.new(EndpointHelper.wsdl_endpoint)
|
|
14
10
|
end
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@wsdl.namespace_uri.should == UserFixture.namespace_uri
|
|
19
|
-
end
|
|
12
|
+
it "has a getter for the namespace URI" do
|
|
13
|
+
@wsdl.namespace_uri.should == UserFixture.namespace_uri
|
|
20
14
|
end
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@wsdl.soap_actions.should == UserFixture.soap_actions
|
|
16
|
+
it "has a getter for returning an Array of available SOAP actions" do
|
|
17
|
+
UserFixture.soap_actions.each do |soap_action|
|
|
18
|
+
@wsdl.soap_actions.should include soap_action
|
|
26
19
|
end
|
|
20
|
+
end
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
lambda { wsdl.soap_actions }.should raise_error ArgumentError
|
|
31
|
-
end
|
|
22
|
+
it "has a getter for returning a Hash of available SOAP operations" do
|
|
23
|
+
@wsdl.operations.should == UserFixture.operations
|
|
32
24
|
end
|
|
33
25
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@wsdl.respond_to?(UserFixture.soap_actions.keys.first).
|
|
37
|
-
should be_true
|
|
38
|
-
end
|
|
26
|
+
it "responds to SOAP actions while still behaving as usual otherwise" do
|
|
27
|
+
@wsdl.respond_to?(UserFixture.soap_actions.first).should be_true
|
|
39
28
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@wsdl.respond_to?(:some_undefined_method).should be_false
|
|
43
|
-
end
|
|
29
|
+
@wsdl.respond_to?(:object_id).should be_true
|
|
30
|
+
@wsdl.respond_to?(:some_undefined_method).should be_false
|
|
44
31
|
end
|
|
45
32
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
@wsdl.to_s.should == UserFixture.user_wsdl
|
|
49
|
-
end
|
|
33
|
+
it "returns the raw WSDL document for to_s" do
|
|
34
|
+
@wsdl.to_s.should == UserFixture.user_wsdl
|
|
50
35
|
end
|
|
51
36
|
|
|
52
|
-
end
|
|
37
|
+
end
|
data/spec/savon/wsse_spec.rb
CHANGED
|
@@ -2,99 +2,76 @@ require "spec_helper"
|
|
|
2
2
|
|
|
3
3
|
describe Savon::WSSE do
|
|
4
4
|
before do
|
|
5
|
+
Savon::WSSE.username = nil
|
|
6
|
+
Savon::WSSE.password = nil
|
|
7
|
+
Savon::WSSE.digest = false
|
|
8
|
+
|
|
5
9
|
@wsse = Savon::WSSE.new
|
|
6
|
-
@username = "gorilla"
|
|
7
|
-
@password = "secret"
|
|
10
|
+
@username, @password = "gorilla", "secret"
|
|
8
11
|
end
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Savon::WSSE::WSENamespace.should_not be_empty
|
|
14
|
-
end
|
|
13
|
+
it "contains the namespace for WS Security Secext" do
|
|
14
|
+
Savon::WSSE::WSENamespace.should be_a String
|
|
15
|
+
Savon::WSSE::WSENamespace.should_not be_empty
|
|
15
16
|
end
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Savon::WSSE::WSUNamespace.should_not be_empty
|
|
21
|
-
end
|
|
18
|
+
it "contains the namespace for WS Security Utility" do
|
|
19
|
+
Savon::WSSE::WSUNamespace.should be_a String
|
|
20
|
+
Savon::WSSE::WSUNamespace.should_not be_empty
|
|
22
21
|
end
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Savon::WSSE.username.should be_empty
|
|
28
|
-
end
|
|
23
|
+
it "defaults to nil for the WSSE username (global setting)" do
|
|
24
|
+
Savon::WSSE.username.should be_nil
|
|
25
|
+
end
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Savon::WSSE.username = ""
|
|
34
|
-
end
|
|
27
|
+
it "has both getter and setter for the WSSE username (global setting)" do
|
|
28
|
+
Savon::WSSE.username = "gorilla"
|
|
29
|
+
Savon::WSSE.username.should == "gorilla"
|
|
35
30
|
end
|
|
36
31
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Savon::WSSE.password.should be_empty
|
|
41
|
-
end
|
|
32
|
+
it "defaults to nil for the WSSE password (global setting)" do
|
|
33
|
+
Savon::WSSE.password.should be_nil
|
|
34
|
+
end
|
|
42
35
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Savon::WSSE.password = ""
|
|
47
|
-
end
|
|
36
|
+
it "has both getter and setter for the WSSE password (global setting)" do
|
|
37
|
+
Savon::WSSE.password = "secret"
|
|
38
|
+
Savon::WSSE.password.should == "secret"
|
|
48
39
|
end
|
|
49
40
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
end
|
|
41
|
+
it "defaults to nil for whether to use WSSE digest (global setting)" do
|
|
42
|
+
Savon::WSSE.digest?.should be_false
|
|
43
|
+
end
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Savon::WSSE.digest = false
|
|
59
|
-
end
|
|
45
|
+
it "has both getter and setter for whether to use WSSE digest (global setting)" do
|
|
46
|
+
Savon::WSSE.digest = true
|
|
47
|
+
Savon::WSSE.digest?.should == true
|
|
60
48
|
end
|
|
61
49
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
@wsse.username.should be_empty
|
|
66
|
-
end
|
|
50
|
+
it "defaults to nil for the WSSE username" do
|
|
51
|
+
@wsse.username.should be_nil
|
|
52
|
+
end
|
|
67
53
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@wsse.username = nil
|
|
72
|
-
end
|
|
54
|
+
it "has both getter and setter for the WSSE username" do
|
|
55
|
+
@wsse.username = "gorilla"
|
|
56
|
+
@wsse.username.should == "gorilla"
|
|
73
57
|
end
|
|
74
58
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
@wsse.password.should be_empty
|
|
79
|
-
end
|
|
59
|
+
it "defaults to nil for the WSSE password" do
|
|
60
|
+
@wsse.password.should be_nil
|
|
61
|
+
end
|
|
80
62
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
@wsse.password = nil
|
|
85
|
-
end
|
|
63
|
+
it "has both getter and setter for the WSSE password" do
|
|
64
|
+
@wsse.password = "secret"
|
|
65
|
+
@wsse.password.should == "secret"
|
|
86
66
|
end
|
|
87
67
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
end
|
|
68
|
+
it "defaults to nil for whether to use WSSE digest" do
|
|
69
|
+
@wsse.digest?.should be_false
|
|
70
|
+
end
|
|
92
71
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
@wsse.digest = false
|
|
97
|
-
end
|
|
72
|
+
it "has both getter and setter for whether to use WSSE digest" do
|
|
73
|
+
@wsse.digest = true
|
|
74
|
+
@wsse.digest?.should == true
|
|
98
75
|
end
|
|
99
76
|
|
|
100
77
|
describe "header" do
|
|
@@ -117,9 +94,6 @@ describe Savon::WSSE do
|
|
|
117
94
|
header.should include_security_namespaces
|
|
118
95
|
header.should include @username
|
|
119
96
|
header.should include @password
|
|
120
|
-
|
|
121
|
-
Savon::WSSE.username = ""
|
|
122
|
-
Savon::WSSE.password = ""
|
|
123
97
|
end
|
|
124
98
|
end
|
|
125
99
|
|
|
@@ -155,4 +129,4 @@ describe Savon::WSSE do
|
|
|
155
129
|
end
|
|
156
130
|
end
|
|
157
131
|
|
|
158
|
-
end
|
|
132
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
class
|
|
1
|
+
class EndpointHelper
|
|
2
|
+
class << self
|
|
3
|
+
|
|
4
|
+
def wsdl_endpoint(type = nil)
|
|
5
|
+
soap_endpoint(type) << "?wsdl"
|
|
6
|
+
end
|
|
2
7
|
|
|
8
|
+
def soap_endpoint(type = nil)
|
|
9
|
+
case type
|
|
10
|
+
when :multiple then "http://multiple.example.com/UserService"
|
|
11
|
+
when :soap_fault then "http://soapfault.example.com/UserService"
|
|
12
|
+
when :http_error then "http://httperror.example.com/UserService"
|
|
13
|
+
when :invalid then "http://invalid.example.com/UserService"
|
|
14
|
+
else "http://services.example.com/UserService"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
=begin
|
|
3
21
|
@soap_call_endpoint = "http://services.example.com/UserService"
|
|
4
22
|
@some_endpoint = @soap_call_endpoint + "?wsdl"
|
|
5
23
|
@some_endpoint_uri = URI @some_endpoint
|
|
@@ -15,9 +33,6 @@ class SpecHelper
|
|
|
15
33
|
|
|
16
34
|
@soap_invalid_endpoint = "http://invalid.example.com/UserService"
|
|
17
35
|
@invalid_endpoint = @soap_invalid_endpoint + "?wsdl"
|
|
18
|
-
|
|
19
|
-
@wsse_security_nodes = ["wsse:Security", "wsse:UsernameToken",
|
|
20
|
-
"wsse:Username", "wsse:Password", "wsse:Nonce", "wsu:Created"]
|
|
21
36
|
|
|
22
37
|
class << self
|
|
23
38
|
|
|
@@ -30,4 +45,17 @@ class SpecHelper
|
|
|
30
45
|
|
|
31
46
|
end
|
|
32
47
|
|
|
48
|
+
=end
|
|
49
|
+
|
|
50
|
+
class SpecHelper
|
|
51
|
+
=begin
|
|
52
|
+
@wsse_security_nodes = ["wsse:Security", "wsse:UsernameToken",
|
|
53
|
+
"wsse:Username", "wsse:Password", "wsse:Nonce", "wsu:Created"]
|
|
54
|
+
|
|
55
|
+
class << self
|
|
56
|
+
|
|
57
|
+
attr_accessor :wsse_security_nodes
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
=end
|
|
33
61
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: savon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Harrington
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-12-
|
|
12
|
+
date: 2009-12-12 00:00:00 +01:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -71,6 +71,7 @@ extensions: []
|
|
|
71
71
|
extra_rdoc_files:
|
|
72
72
|
- README.textile
|
|
73
73
|
files:
|
|
74
|
+
- CHANGELOG
|
|
74
75
|
- README.textile
|
|
75
76
|
- Rakefile
|
|
76
77
|
- VERSION
|
|
@@ -108,7 +109,7 @@ files:
|
|
|
108
109
|
- spec/savon/wsdl_spec.rb
|
|
109
110
|
- spec/savon/wsse_spec.rb
|
|
110
111
|
- spec/spec_helper.rb
|
|
111
|
-
- spec/
|
|
112
|
+
- spec/spec_helper_classes.rb
|
|
112
113
|
has_rdoc: true
|
|
113
114
|
homepage: http://github.com/rubiii/savon
|
|
114
115
|
licenses: []
|
|
@@ -158,4 +159,4 @@ test_files:
|
|
|
158
159
|
- spec/savon/wsdl_spec.rb
|
|
159
160
|
- spec/savon/wsse_spec.rb
|
|
160
161
|
- spec/spec_helper.rb
|
|
161
|
-
- spec/
|
|
162
|
+
- spec/spec_helper_classes.rb
|