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.
@@ -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
@@ -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
- describe "WSENamespace" do
11
- it "contains namespace for WS Security Secext" do
12
- Savon::WSSE::WSENamespace.should be_a String
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
- describe "WSUNamespace" do
18
- it "contains namespace for WS Security Utility" do
19
- Savon::WSSE::WSUNamespace.should be_a String
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
- describe "@username" do
25
- it "defaults to an empty String" do
26
- Savon::WSSE.username.should be_a String
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
- it "has accessor methods" do
31
- Savon::WSSE.username = "gorilla"
32
- Savon::WSSE.username.should == "gorilla"
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
- describe "@password" do
38
- it "defaults to an empty String" do
39
- Savon::WSSE.password.should be_a String
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
- it "has accessor methods" do
44
- Savon::WSSE.password = "secret"
45
- Savon::WSSE.password.should == "secret"
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
- describe "@digest" do
51
- it "defaults to false" do
52
- Savon::WSSE.digest?.should be_false
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
- it "has accessor methods" do
56
- Savon::WSSE.digest = true
57
- Savon::WSSE.digest?.should == true
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
- describe "username" do
63
- it "defaults to an empty String" do
64
- @wsse.username.should be_a String
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
- it "has accessor methods" do
69
- @wsse.username = "gorilla"
70
- @wsse.username.should == "gorilla"
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
- describe "password" do
76
- it "defaults to an empty String" do
77
- @wsse.password.should be_a String
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
- it "has accessor methods" do
82
- @wsse.password = "secret"
83
- @wsse.password.should == "secret"
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
- describe "digest" do
89
- it "defaults to false" do
90
- @wsse.digest?.should be_false
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
- it "has accessor methods" do
94
- @wsse.digest = true
95
- @wsse.digest?.should == true
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
@@ -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.0
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-06 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
@@ -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/spec_helper_methods.rb
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/spec_helper_methods.rb
162
+ - spec/spec_helper_classes.rb