savon 0.6.8 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,12 +4,12 @@ describe String do
4
4
 
5
5
  describe "self.random" do
6
6
  it "returns a random 100-character String" do
7
- String.random.should be_a String
7
+ String.random.should be_a(String)
8
8
  String.random.length.should == 100
9
9
  end
10
10
 
11
11
  it "returns a random String of a given length" do
12
- String.random(50).should be_a String
12
+ String.random(50).should be_a(String)
13
13
  String.random(50).length.should == 50
14
14
  end
15
15
  end
@@ -5,7 +5,7 @@ describe Savon::Request do
5
5
 
6
6
  it "contains the ContentType for each supported SOAP version" do
7
7
  Savon::SOAPVersions.each do |soap_version|
8
- Savon::Request::ContentType[soap_version].should be_a String
8
+ Savon::Request::ContentType[soap_version].should be_a(String)
9
9
  Savon::Request::ContentType[soap_version].should_not be_empty
10
10
  end
11
11
  end
@@ -20,7 +20,7 @@ describe Savon::Request do
20
20
  end
21
21
 
22
22
  it "defaults to use a Logger instance for logging" do
23
- Savon::Request.logger.should be_a Logger
23
+ Savon::Request.logger.should be_a(Logger)
24
24
  end
25
25
 
26
26
  it "has both getter and setter for the logger to use (global setting)" do
@@ -43,10 +43,6 @@ describe Savon::Request do
43
43
  Savon::Request.new EndpointHelper.wsdl_endpoint
44
44
  end
45
45
 
46
- it "ccepts an optional proxy URI passed in via options" do
47
- Savon::Request.new EndpointHelper.wsdl_endpoint, :proxy => "http://localhost:8080"
48
- end
49
-
50
46
  it "has a getter for the SOAP endpoint URI" do
51
47
  @request.endpoint.should == URI(EndpointHelper.wsdl_endpoint)
52
48
  end
@@ -55,70 +51,28 @@ describe Savon::Request do
55
51
  @request.proxy.should == URI("")
56
52
  end
57
53
 
58
- it "has a setter for specifying an open_timeout" do
59
- @request.open_timeout = 30
54
+ it "should return the Net::HTTP object" do
55
+ @request.http.should be_kind_of(Net::HTTP)
60
56
  end
61
57
 
62
- it "has a setter for specifying a read_timeout" do
63
- @request.read_timeout = 30
58
+ it "should have a method for setting HTTP basic auth credentials" do
59
+ @request.basic_auth "user", "password"
64
60
  end
65
61
 
66
- it "retrieves the WSDL document and returns the Net::HTTPResponse" do
62
+ it "retrieves the WSDL document and returns the Net::HTTP response" do
67
63
  wsdl_response = @request.wsdl
68
64
 
69
- wsdl_response.should be_a Net::HTTPResponse
65
+ wsdl_response.should be_a(Net::HTTPResponse)
70
66
  wsdl_response.body.should == WSDLFixture.authentication
71
67
  end
72
68
 
73
- it "executes a SOAP request and returns the Net::HTTPResponse" do
69
+ it "executes a SOAP request and returns the Net::HTTP response" do
74
70
  soap = Savon::SOAP.new
75
71
  soap.endpoint = URI EndpointHelper.wsdl_endpoint
76
72
  soap_response = @request.soap soap
77
73
 
78
- soap_response.should be_a Net::HTTPResponse
74
+ soap_response.should be_a(Net::HTTPResponse)
79
75
  soap_response.body.should == ResponseFixture.authentication
80
76
  end
81
-
82
- describe "Savon::Request SSL" do
83
- before { @request.class.class_eval { public "http" } }
84
-
85
- it "defaults to not setting ssl parameters" do
86
- http = @request.http
87
- http.cert.should be_nil
88
- http.key.should be_nil
89
- http.ca_file.should be_nil
90
- http.verify_mode.should == OpenSSL::SSL::VERIFY_NONE
91
- end
92
-
93
- it "sets client cert in http object when set in request constructor" do
94
- request = Savon::Request.new(EndpointHelper.wsdl_endpoint, :ssl => {
95
- :client_cert => "client cert"
96
- })
97
- request.http.cert.should == "client cert"
98
- end
99
-
100
- it "sets ca cert in http object when set in request constructor" do
101
- request = Savon::Request.new(EndpointHelper.wsdl_endpoint, :ssl => {
102
- :client_key => "client key"
103
- })
104
- request.http.key.should == "client key"
105
- end
106
-
107
- it "sets client cert in http object when set in request constructor" do
108
- request = Savon::Request.new(EndpointHelper.wsdl_endpoint, :ssl => {
109
- :ca_file => "ca file"
110
- })
111
- request.http.ca_file.should == "ca file"
112
- end
113
77
 
114
- it "sets client cert in http object when set in request constructor" do
115
- request = Savon::Request.new(EndpointHelper.wsdl_endpoint, :ssl => {
116
- :verify => OpenSSL::SSL::VERIFY_PEER
117
- })
118
- request.http.verify_mode.should == OpenSSL::SSL::VERIFY_PEER
119
- end
120
-
121
- after { @request.class.class_eval { private "http" } }
122
- end
123
-
124
78
  end
@@ -19,7 +19,7 @@ describe Savon::Response do
19
19
  end
20
20
 
21
21
  it "raises a Savon::SOAPFault in case of a SOAP fault" do
22
- lambda { savon_response_with :soap_fault }.should raise_error Savon::SOAPFault
22
+ lambda { savon_response_with :soap_fault }.should raise_error(Savon::SOAPFault)
23
23
  end
24
24
 
25
25
  it "does not raise a Savon::SOAPFault in case the default is turned off" do
@@ -29,7 +29,7 @@ describe Savon::Response do
29
29
  end
30
30
 
31
31
  it "raises a Savon::HTTPError in case of an HTTP error" do
32
- lambda { savon_response_with :http_error }.should raise_error Savon::HTTPError
32
+ lambda { savon_response_with :http_error }.should raise_error(Savon::HTTPError)
33
33
  end
34
34
 
35
35
  it "does not raise a Savon::HTTPError in case the default is turned off" do
@@ -93,11 +93,19 @@ describe Savon::Response do
93
93
  after { Savon::Response.raise_errors = true }
94
94
  end
95
95
 
96
- it "can return the SOAP response body as a Hash" do
97
- @response.to_hash[:return].should == ResponseFixture.authentication(:to_hash)
96
+ it "should return the SOAP response body as a Hash" do
97
+ @response.to_hash[:authenticate_response][:return].should ==
98
+ ResponseFixture.authentication(:to_hash)
98
99
  end
99
100
 
100
- it "can return the raw SOAP response body" do
101
+ it "should return a Hash for a SOAP multiRef response" do
102
+ @response = Savon::Response.new http_response_mock(200, ResponseFixture.multi_ref, "OK")
103
+
104
+ @response.to_hash[:list_response].should be_a(Hash)
105
+ @response.to_hash[:multi_ref].should be_an(Array)
106
+ end
107
+
108
+ it "should return the raw SOAP response body" do
101
109
  @response.to_xml.should == ResponseFixture.authentication
102
110
  @response.to_s.should == ResponseFixture.authentication
103
111
  end
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe Savon do
4
4
 
5
5
  it "contains an Array of supported SOAP versions" do
6
- Savon::SOAPVersions.should be_an Array
6
+ Savon::SOAPVersions.should be_an(Array)
7
7
  Savon::SOAPVersions.should_not be_empty
8
8
  end
9
9
 
10
10
  it "contains the xs:dateTime format" do
11
- Savon::SOAPDateTimeFormat.should be_a String
11
+ Savon::SOAPDateTimeFormat.should be_a(String)
12
12
  Savon::SOAPDateTimeFormat.should_not be_empty
13
13
 
14
14
  DateTime.new(2012, 03, 22, 16, 22, 33).strftime(Savon::SOAPDateTimeFormat).
@@ -16,7 +16,7 @@ describe Savon do
16
16
  end
17
17
 
18
18
  it "contains a Regexp matching the xs:dateTime format" do
19
- Savon::SOAPDateTimeRegexp.should be_a Regexp
19
+ Savon::SOAPDateTimeRegexp.should be_a(Regexp)
20
20
  (Savon::SOAPDateTimeRegexp === "2012-03-22T16:22:33").should be_true
21
21
  end
22
22
 
@@ -8,14 +8,14 @@ describe Savon::SOAP do
8
8
 
9
9
  it "contains the SOAP namespace for each supported SOAP version" do
10
10
  Savon::SOAPVersions.each do |soap_version|
11
- Savon::SOAP::SOAPNamespace[soap_version].should be_a String
11
+ Savon::SOAP::SOAPNamespace[soap_version].should be_a(String)
12
12
  Savon::SOAP::SOAPNamespace[soap_version].should_not be_empty
13
13
  end
14
14
  end
15
15
 
16
16
  it "contains the Content-Types for each supported SOAP version" do
17
17
  Savon::SOAPVersions.each do |soap_version|
18
- Savon::SOAP::ContentType[soap_version].should be_a String
18
+ Savon::SOAP::ContentType[soap_version].should be_a(String)
19
19
  Savon::SOAP::ContentType[soap_version].should_not be_empty
20
20
  end
21
21
  end
@@ -47,7 +47,7 @@ describe Savon::SOAP do
47
47
  end
48
48
 
49
49
  it "has both getter and setter for the SOAP header" do
50
- @soap.header.should be_a Hash
50
+ @soap.header.should be_a(Hash)
51
51
  @soap.header.should be_empty
52
52
 
53
53
  @soap.header = { "specialAuthKey" => "secret" }
@@ -76,6 +76,14 @@ describe Savon::SOAP do
76
76
  end
77
77
  end
78
78
 
79
+ it "has a convenience method for setting the 'xmlns:wsdl' namespace" do
80
+ @soap.namespaces.should == { "xmlns:env" => "http://schemas.xmlsoap.org/soap/envelope/" }
81
+
82
+ @soap.namespace = "http://example.com"
83
+ @soap.namespaces.should include("xmlns:env" => "http://schemas.xmlsoap.org/soap/envelope/")
84
+ @soap.namespaces.should include("xmlns:wsdl" => "http://example.com")
85
+ end
86
+
79
87
  it "has both getter and setter for the SOAP endpoint" do
80
88
  @soap.endpoint.should be_nil
81
89
 
@@ -100,9 +108,9 @@ describe Savon::SOAP do
100
108
  @soap.namespaces["xmlns:wsdl"] = "http://v1_0.ws.auth.order.example.com/"
101
109
  @soap.body = { :id => 666 }
102
110
 
103
- @soap.to_xml.should include 'xmlns:wsdl="http://v1_0.ws.auth.order.example.com/"'
104
- @soap.to_xml.should include 'xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"'
105
- @soap.to_xml.should include '<wsdl:authenticate><id>666</id></wsdl:authenticate>'
111
+ @soap.to_xml.should include('xmlns:wsdl="http://v1_0.ws.auth.order.example.com/"')
112
+ @soap.to_xml.should include('xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"')
113
+ @soap.to_xml.should include('<wsdl:authenticate><id>666</id></wsdl:authenticate>')
106
114
  end
107
115
 
108
116
  it "caches the XML, returning the same Object every time" do
@@ -111,12 +119,12 @@ describe Savon::SOAP do
111
119
 
112
120
  it "uses the SOAP namespace for the specified SOAP version" do
113
121
  @soap.version = 2
114
- @soap.to_xml.should include Savon::SOAP::SOAPNamespace[2]
122
+ @soap.to_xml.should include(Savon::SOAP::SOAPNamespace[2])
115
123
  end
116
124
 
117
125
  it "uses the SOAP namespace for the default SOAP version otherwise" do
118
126
  Savon::SOAP.version = 2
119
- @soap.to_xml.should include Savon::SOAP::SOAPNamespace[2]
127
+ @soap.to_xml.should include(Savon::SOAP::SOAPNamespace[2])
120
128
  end
121
129
  end
122
130
 
@@ -8,13 +8,17 @@ describe Savon::WSDL do
8
8
  Savon::WSDL.new Savon::Request.new(EndpointHelper.wsdl_endpoint)
9
9
  end
10
10
 
11
+ it "is enabled by default" do
12
+ @wsdl.enabled?.should be_true
13
+ end
14
+
11
15
  it "has a getter for the namespace URI" do
12
16
  @wsdl.namespace_uri.should == WSDLFixture.authentication(:namespace_uri)
13
17
  end
14
18
 
15
19
  it "has a getter for returning an Array of available SOAP actions" do
16
20
  WSDLFixture.authentication(:operations).keys.each do |soap_action|
17
- @wsdl.soap_actions.should include soap_action
21
+ @wsdl.soap_actions.should include(soap_action)
18
22
  end
19
23
  end
20
24
 
@@ -45,7 +49,7 @@ describe Savon::WSDL do
45
49
 
46
50
  it "returns an Array of available SOAP actions" do
47
51
  WSDLFixture.no_namespace(:operations).keys.each do |soap_action|
48
- @wsdl.soap_actions.should include soap_action
52
+ @wsdl.soap_actions.should include(soap_action)
49
53
  end
50
54
  end
51
55
 
@@ -63,7 +67,7 @@ describe Savon::WSDL do
63
67
 
64
68
  it "returns an Array of available SOAP actions" do
65
69
  WSDLFixture.namespaced_actions(:operations).keys.each do |soap_action|
66
- @wsdl.soap_actions.should include soap_action
70
+ @wsdl.soap_actions.should include(soap_action)
67
71
  end
68
72
  end
69
73
 
@@ -11,12 +11,12 @@ describe Savon::WSSE do
11
11
  end
12
12
 
13
13
  it "contains the namespace for WS Security Secext" do
14
- Savon::WSSE::WSENamespace.should be_a String
14
+ Savon::WSSE::WSENamespace.should be_a(String)
15
15
  Savon::WSSE::WSENamespace.should_not be_empty
16
16
  end
17
17
 
18
18
  it "contains the namespace for WS Security Utility" do
19
- Savon::WSSE::WSUNamespace.should be_a String
19
+ Savon::WSSE::WSUNamespace.should be_a(String)
20
20
  Savon::WSSE::WSUNamespace.should_not be_empty
21
21
  end
22
22
 
@@ -82,8 +82,8 @@ describe Savon::WSSE do
82
82
  header = @wsse.header
83
83
 
84
84
  header.should include_security_namespaces
85
- header.should include @username
86
- header.should include @password
85
+ header.should include(@username)
86
+ header.should include(@password)
87
87
  end
88
88
 
89
89
  it "with WSSE credentials specified via defaults" do
@@ -92,8 +92,8 @@ describe Savon::WSSE do
92
92
  header = @wsse.header
93
93
 
94
94
  header.should include_security_namespaces
95
- header.should include @username
96
- header.should include @password
95
+ header.should include(@username)
96
+ header.should include(@password)
97
97
  end
98
98
  end
99
99
 
@@ -105,8 +105,8 @@ describe Savon::WSSE do
105
105
  header = @wsse.header
106
106
 
107
107
  header.should include_security_namespaces
108
- header.should include @username
109
- header.should_not include @password
108
+ header.should include(@username)
109
+ header.should_not include(@password)
110
110
  end
111
111
 
112
112
  it "via defaults" do
@@ -116,15 +116,15 @@ describe Savon::WSSE do
116
116
  header = @wsse.header
117
117
 
118
118
  header.should include_security_namespaces
119
- header.should include @username
120
- header.should_not include @password
119
+ header.should include(@username)
120
+ header.should_not include(@password)
121
121
  end
122
122
  end
123
123
 
124
124
  def include_security_namespaces
125
125
  simple_matcher("include security namespaces") do |given|
126
- given.should include Savon::WSSE::WSENamespace
127
- given.should include Savon::WSSE::WSUNamespace
126
+ given.should include(Savon::WSSE::WSENamespace)
127
+ given.should include(Savon::WSSE::WSUNamespace)
128
128
  end
129
129
  end
130
130
  end
@@ -1,15 +1,4 @@
1
- require "rubygems"
2
- require "rake"
3
- require "spec"
4
- require "mocha"
5
- require "fakeweb"
6
-
7
- Spec::Runner.configure do |config|
8
- config.mock_with :mocha
9
- end
10
-
11
- require "savon"
12
- Savon::Request.log = false
1
+ require "basic_spec_helper"
13
2
 
14
3
  FileList["spec/fixtures/**/*.rb"].each { |fixture| require fixture }
15
4
  require "endpoint_helper"
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.8
4
+ version: 0.7.0
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: 2010-01-01 00:00:00 +01:00
12
+ date: 2010-01-09 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -77,6 +77,7 @@ files:
77
77
  - lib/savon/client.rb
78
78
  - lib/savon/core_ext/datetime.rb
79
79
  - lib/savon/core_ext/hash.rb
80
+ - lib/savon/core_ext/net_http.rb
80
81
  - lib/savon/core_ext/object.rb
81
82
  - lib/savon/core_ext/string.rb
82
83
  - lib/savon/core_ext/symbol.rb
@@ -88,13 +89,17 @@ files:
88
89
  - lib/savon/wsdl.rb
89
90
  - lib/savon/wsse.rb
90
91
  - lib/savon.rb
92
+ - spec/basic_spec_helper.rb
91
93
  - spec/endpoint_helper.rb
92
94
  - spec/fixtures/response/response_fixture.rb
93
95
  - spec/fixtures/wsdl/wsdl_fixture.rb
94
96
  - spec/http_stubs.rb
97
+ - spec/integration/http_basic_auth_spec.rb
98
+ - spec/integration/server.rb
95
99
  - spec/savon/client_spec.rb
96
100
  - spec/savon/core_ext/datetime_spec.rb
97
101
  - spec/savon/core_ext/hash_spec.rb
102
+ - spec/savon/core_ext/net_http_spec.rb
98
103
  - spec/savon/core_ext/object_spec.rb
99
104
  - spec/savon/core_ext/string_spec.rb
100
105
  - spec/savon/core_ext/symbol_spec.rb
@@ -107,6 +112,7 @@ files:
107
112
  - spec/savon/wsse_spec.rb
108
113
  - spec/spec_helper.rb
109
114
  - spec/fixtures/response/xml/authentication.xml
115
+ - spec/fixtures/response/xml/multi_ref.xml
110
116
  - spec/fixtures/response/xml/soap_fault.xml
111
117
  - spec/fixtures/response/xml/soap_fault12.xml
112
118
  - spec/fixtures/wsdl/xml/authentication.xml
@@ -145,13 +151,17 @@ signing_key:
145
151
  specification_version: 3
146
152
  summary: Heavy metal Ruby SOAP client library
147
153
  test_files:
154
+ - spec/basic_spec_helper.rb
148
155
  - spec/endpoint_helper.rb
149
156
  - spec/fixtures/response/response_fixture.rb
150
157
  - spec/fixtures/wsdl/wsdl_fixture.rb
151
158
  - spec/http_stubs.rb
159
+ - spec/integration/http_basic_auth_spec.rb
160
+ - spec/integration/server.rb
152
161
  - spec/savon/client_spec.rb
153
162
  - spec/savon/core_ext/datetime_spec.rb
154
163
  - spec/savon/core_ext/hash_spec.rb
164
+ - spec/savon/core_ext/net_http_spec.rb
155
165
  - spec/savon/core_ext/object_spec.rb
156
166
  - spec/savon/core_ext/string_spec.rb
157
167
  - spec/savon/core_ext/symbol_spec.rb