savon 0.3.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/README.textile +68 -0
  2. data/Rakefile +9 -7
  3. data/VERSION +1 -1
  4. data/lib/savon.rb +33 -34
  5. data/lib/savon/client.rb +96 -0
  6. data/lib/savon/core_ext.rb +6 -0
  7. data/lib/savon/core_ext/datetime.rb +8 -0
  8. data/lib/savon/core_ext/hash.rb +65 -0
  9. data/lib/savon/core_ext/object.rb +14 -0
  10. data/lib/savon/core_ext/string.rb +41 -0
  11. data/lib/savon/core_ext/symbol.rb +8 -0
  12. data/lib/savon/core_ext/uri.rb +10 -0
  13. data/lib/savon/request.rb +103 -0
  14. data/lib/savon/soap.rb +71 -0
  15. data/lib/savon/validation.rb +57 -0
  16. data/lib/savon/wsdl.rb +39 -41
  17. data/lib/savon/wsse.rb +111 -0
  18. data/spec/fixtures/multiple_user_response.xml +22 -0
  19. data/spec/fixtures/soap_fault.xml +0 -0
  20. data/spec/fixtures/user_fixture.rb +42 -0
  21. data/spec/fixtures/user_response.xml +4 -2
  22. data/spec/fixtures/user_wsdl.xml +0 -0
  23. data/spec/http_stubs.rb +20 -0
  24. data/spec/savon/client_spec.rb +144 -0
  25. data/spec/savon/core_ext/datetime_spec.rb +12 -0
  26. data/spec/savon/core_ext/hash_spec.rb +146 -0
  27. data/spec/savon/core_ext/object_spec.rb +26 -0
  28. data/spec/savon/core_ext/string_spec.rb +52 -0
  29. data/spec/savon/core_ext/symbol_spec.rb +11 -0
  30. data/spec/savon/core_ext/uri_spec.rb +15 -0
  31. data/spec/savon/request_spec.rb +93 -0
  32. data/spec/savon/savon_spec.rb +37 -0
  33. data/spec/savon/soap_spec.rb +101 -0
  34. data/spec/savon/validation_spec.rb +88 -0
  35. data/spec/savon/wsdl_spec.rb +17 -46
  36. data/spec/savon/wsse_spec.rb +169 -0
  37. data/spec/spec_helper.rb +7 -92
  38. data/spec/spec_helper_methods.rb +29 -0
  39. metadata +68 -20
  40. data/README.rdoc +0 -62
  41. data/lib/savon/service.rb +0 -151
  42. data/spec/savon/service_spec.rb +0 -76
@@ -1,76 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "..", "spec_helper")
2
-
3
- describe Savon::Service do
4
- include SpecHelper
5
-
6
- # initialize
7
- describe "initialize" do
8
- it "raises an ArgumentError when called with an invalid endpoint" do
9
- ["", nil, "invalid", 123].each do |argument|
10
- lambda { Savon::Service.new(argument) }.should raise_error(ArgumentError)
11
- end
12
- end
13
-
14
- it "raises an ArgumentError when called with an invalid version" do
15
- ["", nil, "invalid", 123].each do |argument|
16
- lambda { Savon::Service.new("http://example.com", argument) }.
17
- should raise_error(ArgumentError)
18
- end
19
- end
20
- end
21
-
22
- # wsdl
23
- describe "wsdl" do
24
- before { @service = new_service_instance }
25
-
26
- it "returns an instance of Savon::WSDL" do
27
- @service.wsdl.should be_a(Savon::WSDL)
28
- end
29
-
30
- it "returns the exact same Savon::WSDL instance every time" do
31
- @service.wsdl.should equal(@service.wsdl)
32
- end
33
- end
34
-
35
- # method_missing
36
- describe "method_missing" do
37
- before { @service = new_service_instance }
38
-
39
- it "raises a NoMethodError when called with an invalid soap_action" do
40
- lambda { @service.invalid_action }.should raise_error(NoMethodError)
41
- end
42
-
43
- it "by default returns content from the response using the '//return' XPath" do
44
- @service.find_user.should == { :firstname => "The", :lastname => "Dude",
45
- :email => "thedude@example.com", :username => "thedude", :id => "123" }
46
- end
47
-
48
- it "returns the content of the response starting at a custom XPath" do
49
- @service.find_user(nil, "//email").should == "thedude@example.com"
50
- end
51
-
52
- it "returns nil if a given XPath does not match anything from the SOAP response" do
53
- @service.find_user(nil, "//doesNotMatchAnything").should be_nil
54
- end
55
-
56
- it "raises a Savon::SOAPFault in case of a SOAP fault" do
57
- @service = new_service_instance(:soap_fault => true)
58
- lambda { @service.find_user }.should raise_error(Savon::SOAPFault)
59
- end
60
-
61
- it "raises a Savon::HTTPError in case the server returned an error code and no SOAP fault" do
62
- @service = new_service_instance(:http_error => true)
63
- lambda { @service.find_user }.should raise_error(Savon::HTTPError)
64
- end
65
-
66
- it "raises a Savon::SOAPFault in case the server returned an error code and a SOAP fault" do
67
- @service = new_service_instance(:soap_fault => true, :http_error => true)
68
- lambda { @service.find_user }.should raise_error(Savon::SOAPFault)
69
- end
70
-
71
- it "returns the raw response body when :pure_response was set to +true+" do
72
- @service.pure_response = true
73
- @service.find_user.should == UserFixture.user_response
74
- end
75
- end
76
- end