savon 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/CHANGELOG +31 -7
  2. data/README.textile +0 -0
  3. data/Rakefile +1 -1
  4. data/VERSION +1 -1
  5. data/lib/savon.rb +0 -0
  6. data/lib/savon/client.rb +6 -1
  7. data/lib/savon/core_ext.rb +0 -0
  8. data/lib/savon/core_ext/datetime.rb +0 -0
  9. data/lib/savon/core_ext/hash.rb +0 -0
  10. data/lib/savon/core_ext/object.rb +0 -0
  11. data/lib/savon/core_ext/string.rb +0 -0
  12. data/lib/savon/core_ext/symbol.rb +0 -0
  13. data/lib/savon/core_ext/uri.rb +0 -0
  14. data/lib/savon/request.rb +5 -0
  15. data/lib/savon/response.rb +0 -0
  16. data/lib/savon/soap.rb +11 -9
  17. data/lib/savon/wsdl.rb +67 -31
  18. data/lib/savon/wsse.rb +0 -0
  19. data/spec/fixtures/multiple_user_response.xml +0 -0
  20. data/spec/fixtures/soap_fault.xml +0 -0
  21. data/spec/fixtures/user_fixture.rb +8 -4
  22. data/spec/fixtures/user_response.xml +0 -0
  23. data/spec/fixtures/user_wsdl.xml +0 -0
  24. data/spec/http_stubs.rb +15 -17
  25. data/spec/savon/client_spec.rb +46 -47
  26. data/spec/savon/core_ext/datetime_spec.rb +0 -0
  27. data/spec/savon/core_ext/hash_spec.rb +0 -0
  28. data/spec/savon/core_ext/object_spec.rb +0 -0
  29. data/spec/savon/core_ext/string_spec.rb +0 -0
  30. data/spec/savon/core_ext/symbol_spec.rb +0 -0
  31. data/spec/savon/core_ext/uri_spec.rb +0 -0
  32. data/spec/savon/request_spec.rb +44 -64
  33. data/spec/savon/response_spec.rb +34 -51
  34. data/spec/savon/savon_spec.rb +13 -19
  35. data/spec/savon/soap_spec.rb +61 -92
  36. data/spec/savon/wsdl_spec.rb +19 -34
  37. data/spec/savon/wsse_spec.rb +42 -58
  38. data/spec/spec_helper.rb +1 -1
  39. data/spec/{spec_helper_methods.rb → spec_helper_classes.rb} +32 -4
  40. metadata +15 -15
@@ -1,52 +1,37 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Savon::WSDL do
4
- before { @wsdl = some_wsdl_instance }
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
- describe "initialize" do
11
- it "expects a Savon::Request object" do
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
- describe "namespace_uri" do
17
- it "returns the namespace URI from the WSDL" do
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
- describe "soap_actions" do
23
- it "returns a Hash containing all available SOAP actions, as well as" <<
24
- "their original names and inputs" do
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
- it "raises an ArgumentError in case the WSDL seems to be invalid" do
29
- wsdl = Savon::WSDL.new Savon::Request.new SpecHelper.invalid_endpoint
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
- describe "respond_to?" do
35
- it "returns true for available SOAP actions" do
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
- it "still behaves like usual otherwise" do
41
- @wsdl.respond_to?(:object_id).should be_true
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
- describe "to_s" do
47
- it "returns the WSDL document" do
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
@@ -10,84 +10,68 @@ describe Savon::WSSE do
10
10
  @username, @password = "gorilla", "secret"
11
11
  end
12
12
 
13
- describe "WSENamespace" do
14
- it "contains namespace for WS Security Secext" do
15
- Savon::WSSE::WSENamespace.should be_a String
16
- Savon::WSSE::WSENamespace.should_not be_empty
17
- 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
18
16
  end
19
17
 
20
- describe "WSUNamespace" do
21
- it "contains namespace for WS Security Utility" do
22
- Savon::WSSE::WSUNamespace.should be_a String
23
- Savon::WSSE::WSUNamespace.should_not be_empty
24
- 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
25
21
  end
26
22
 
27
- describe "@username" do
28
- it "defaults to nil" do
29
- Savon::WSSE.username.should be_nil
30
- end
23
+ it "defaults to nil for the WSSE username (global setting)" do
24
+ Savon::WSSE.username.should be_nil
25
+ end
31
26
 
32
- it "has accessor methods" do
33
- Savon::WSSE.username = "gorilla"
34
- Savon::WSSE.username.should == "gorilla"
35
- 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"
36
30
  end
37
31
 
38
- describe "@password" do
39
- it "defaults to nil" do
40
- Savon::WSSE.password.should be_nil
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
- it "has accessor methods" do
44
- Savon::WSSE.password = "secret"
45
- Savon::WSSE.password.should == "secret"
46
- 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"
47
39
  end
48
40
 
49
- describe "@digest" do
50
- it "defaults to false" do
51
- Savon::WSSE.digest?.should be_false
52
- end
41
+ it "defaults to nil for whether to use WSSE digest (global setting)" do
42
+ Savon::WSSE.digest?.should be_false
43
+ end
53
44
 
54
- it "has accessor methods" do
55
- Savon::WSSE.digest = true
56
- Savon::WSSE.digest?.should == true
57
- 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
58
48
  end
59
49
 
60
- describe "username" do
61
- it "defaults to nil" do
62
- @wsse.username.should be_nil
63
- end
50
+ it "defaults to nil for the WSSE username" do
51
+ @wsse.username.should be_nil
52
+ end
64
53
 
65
- it "has accessor methods" do
66
- @wsse.username = "gorilla"
67
- @wsse.username.should == "gorilla"
68
- end
54
+ it "has both getter and setter for the WSSE username" do
55
+ @wsse.username = "gorilla"
56
+ @wsse.username.should == "gorilla"
69
57
  end
70
58
 
71
- describe "password" do
72
- it "defaults to nil" do
73
- @wsse.password.should be_nil
74
- end
59
+ it "defaults to nil for the WSSE password" do
60
+ @wsse.password.should be_nil
61
+ end
75
62
 
76
- it "has accessor methods" do
77
- @wsse.password = "secret"
78
- @wsse.password.should == "secret"
79
- end
63
+ it "has both getter and setter for the WSSE password" do
64
+ @wsse.password = "secret"
65
+ @wsse.password.should == "secret"
80
66
  end
81
67
 
82
- describe "digest" do
83
- it "defaults to false" do
84
- @wsse.digest?.should be_false
85
- end
68
+ it "defaults to nil for whether to use WSSE digest" do
69
+ @wsse.digest?.should be_false
70
+ end
86
71
 
87
- it "has accessor methods" do
88
- @wsse.digest = true
89
- @wsse.digest?.should == true
90
- end
72
+ it "has both getter and setter for whether to use WSSE digest" do
73
+ @wsse.digest = true
74
+ @wsse.digest?.should == true
91
75
  end
92
76
 
93
77
  describe "header" do
@@ -11,5 +11,5 @@ require "savon"
11
11
  Savon::Request.log = false
12
12
 
13
13
  require "fixtures/user_fixture"
14
- require "spec_helper_methods"
14
+ require "spec_helper_classes"
15
15
  require "http_stubs"
@@ -1,5 +1,23 @@
1
- class SpecHelper
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.3
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-11 00:00:00 +01:00
12
+ date: 2009-12-12 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -109,7 +109,7 @@ files:
109
109
  - spec/savon/wsdl_spec.rb
110
110
  - spec/savon/wsse_spec.rb
111
111
  - spec/spec_helper.rb
112
- - spec/spec_helper_methods.rb
112
+ - spec/spec_helper_classes.rb
113
113
  has_rdoc: true
114
114
  homepage: http://github.com/rubiii/savon
115
115
  licenses: []
@@ -143,20 +143,20 @@ signing_key:
143
143
  specification_version: 3
144
144
  summary: Heavy metal Ruby SOAP client library
145
145
  test_files:
146
- - spec/spec_helper.rb
147
- - spec/savon/response_spec.rb
148
- - spec/savon/savon_spec.rb
149
- - spec/savon/wsdl_spec.rb
150
- - spec/savon/request_spec.rb
146
+ - spec/fixtures/user_fixture.rb
147
+ - spec/http_stubs.rb
151
148
  - spec/savon/client_spec.rb
152
- - spec/savon/soap_spec.rb
153
- - spec/savon/core_ext/symbol_spec.rb
154
- - spec/savon/core_ext/hash_spec.rb
155
- - spec/savon/core_ext/string_spec.rb
156
149
  - spec/savon/core_ext/datetime_spec.rb
150
+ - spec/savon/core_ext/hash_spec.rb
157
151
  - spec/savon/core_ext/object_spec.rb
152
+ - spec/savon/core_ext/string_spec.rb
153
+ - spec/savon/core_ext/symbol_spec.rb
158
154
  - spec/savon/core_ext/uri_spec.rb
155
+ - spec/savon/request_spec.rb
156
+ - spec/savon/response_spec.rb
157
+ - spec/savon/savon_spec.rb
158
+ - spec/savon/soap_spec.rb
159
+ - spec/savon/wsdl_spec.rb
159
160
  - spec/savon/wsse_spec.rb
160
- - spec/spec_helper_methods.rb
161
- - spec/http_stubs.rb
162
- - spec/fixtures/user_fixture.rb
161
+ - spec/spec_helper.rb
162
+ - spec/spec_helper_classes.rb