savon 2.9.0 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/lib/savon/mock/expectation.rb +2 -2
- data/lib/savon/request_logger.rb +5 -5
- data/lib/savon/version.rb +1 -1
- data/savon.gemspec +1 -1
- data/spec/savon/mock_spec.rb +6 -0
- data/spec/savon/options_spec.rb +19 -26
- data/spec/savon/request_logger_spec.rb +37 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 041367085f94b9a23b1dc4725ce5e776c1efdaca
|
4
|
+
data.tar.gz: 3920e53e9e6246063ab38a64aa7d26f31adc3dbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 952a31b9b054f74ee5e152b3a85628b6a511e4ea5b134f0098b886940b27f23c2e23eb685241e6a79057ddfa9837dfc800adec5a8bf5e249f2d979fa2e296506
|
7
|
+
data.tar.gz: 02d114680d544563398f70e74d1b46f5c4c3b7a0643ab165fc354cbb84d24a5472be5a156fc55ab07014a721ef97db523b9485ac42c544d517bba0e4e9ac5c83
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -54,8 +54,8 @@ module Savon
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def verify_message!
|
57
|
-
return if @expected[:message]
|
58
|
-
unless @expected[:message]
|
57
|
+
return if @expected[:message].eql? :any
|
58
|
+
unless @expected[:message] === @actual[:message]
|
59
59
|
expected_message = " with this message: #{@expected[:message].inspect}" if @expected[:message]
|
60
60
|
expected_message ||= " with no message."
|
61
61
|
|
data/lib/savon/request_logger.rb
CHANGED
@@ -26,14 +26,14 @@ module Savon
|
|
26
26
|
private
|
27
27
|
|
28
28
|
def log_request(request)
|
29
|
-
logger.info "SOAP request: #{request.url}"
|
30
|
-
logger.info headers_to_log(request.headers)
|
31
|
-
logger.debug body_to_log(request.body)
|
29
|
+
logger.info { "SOAP request: #{request.url}" }
|
30
|
+
logger.info { headers_to_log(request.headers) }
|
31
|
+
logger.debug { body_to_log(request.body) }
|
32
32
|
end
|
33
33
|
|
34
34
|
def log_response(response)
|
35
|
-
logger.info "SOAP response (status #{response.code})"
|
36
|
-
logger.debug body_to_log(response.body)
|
35
|
+
logger.info { "SOAP response (status #{response.code})" }
|
36
|
+
logger.debug { body_to_log(response.body) }
|
37
37
|
end
|
38
38
|
|
39
39
|
def headers_to_log(headers)
|
data/lib/savon/version.rb
CHANGED
data/savon.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.add_dependency "nori", "~> 2.4"
|
20
20
|
s.add_dependency "httpi", "~> 2.3"
|
21
|
-
s.add_dependency "wasabi", "3.
|
21
|
+
s.add_dependency "wasabi", "~> 3.4"
|
22
22
|
s.add_dependency "akami", "~> 1.2"
|
23
23
|
s.add_dependency "gyoku", "~> 1.2"
|
24
24
|
s.add_dependency "uuid", "~> 2.3.7"
|
data/spec/savon/mock_spec.rb
CHANGED
@@ -127,6 +127,12 @@ describe "Savon's mock interface" do
|
|
127
127
|
expect { new_client.call(:find_user) }.to_not raise_error
|
128
128
|
end
|
129
129
|
|
130
|
+
it "matchers can be used to specify the message" do
|
131
|
+
savon.expects(:find_user).with(:message => include(:username)).returns("<fixture/>")
|
132
|
+
message = { :username => "Han Solo", password: "querty"}
|
133
|
+
|
134
|
+
expect { new_client.call(:find_user, :message => message) }.to_not raise_error
|
135
|
+
end
|
130
136
|
|
131
137
|
it "allows code to rescue Savon::Error and still report test failures" do
|
132
138
|
message = { :username => "luke" }
|
data/spec/savon/options_spec.rb
CHANGED
@@ -504,46 +504,39 @@ describe "Options" do
|
|
504
504
|
|
505
505
|
context "global :filters" do
|
506
506
|
it "filters a list of XML tags from logged SOAP messages" do
|
507
|
-
|
507
|
+
captured = mock_stdout do
|
508
508
|
client = new_client(:endpoint => @server.url(:repeat), :log => true)
|
509
|
-
|
510
509
|
client.globals[:filters] << :password
|
511
510
|
|
512
|
-
# filter out logs we're not interested in
|
513
|
-
client.globals[:logger].expects(:info).at_least_once
|
514
|
-
client.globals[:logger].expects(:debug).at_least_once
|
515
|
-
|
516
|
-
# check whether the password is filtered
|
517
|
-
client.globals[:logger].expects(:debug).with { |message|
|
518
|
-
message.include? "<password>***FILTERED***</password>"
|
519
|
-
}.twice
|
520
|
-
|
521
511
|
message = { :username => "luke", :password => "secret" }
|
522
512
|
client.call(:authenticate, :message => message)
|
523
513
|
end
|
514
|
+
|
515
|
+
captured.rewind
|
516
|
+
messages = captured.readlines.join("\n")
|
517
|
+
|
518
|
+
expect(messages).to include("<password>***FILTERED***</password>")
|
524
519
|
end
|
525
520
|
end
|
526
521
|
|
527
522
|
context "global :pretty_print_xml" do
|
528
523
|
it "is a nice but expensive way to debug XML messages" do
|
529
|
-
|
530
|
-
client = new_client(
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
client.globals[:logger].
|
535
|
-
|
536
|
-
# check whether the message is pretty printed
|
537
|
-
client.globals[:logger].expects(:debug).with { |message|
|
538
|
-
envelope = message =~ /\n<env:Envelope/
|
539
|
-
body = message =~ /\n <env:Body>/
|
540
|
-
message_tag = message =~ /\n <tns:authenticate\/>/
|
541
|
-
|
542
|
-
envelope && body && message_tag
|
543
|
-
}.twice
|
524
|
+
captured = mock_stdout do
|
525
|
+
client = new_client(
|
526
|
+
:endpoint => @server.url(:repeat),
|
527
|
+
:pretty_print_xml => true,
|
528
|
+
:log => true)
|
529
|
+
client.globals[:logger].formatter = proc { |*, msg| "#{msg}\n" }
|
544
530
|
|
545
531
|
client.call(:authenticate)
|
546
532
|
end
|
533
|
+
|
534
|
+
captured.rewind
|
535
|
+
messages = captured.readlines.join("\n")
|
536
|
+
|
537
|
+
expect(messages).to match(/\n<env:Envelope/)
|
538
|
+
expect(messages).to match(/\n <env:Body/)
|
539
|
+
expect(messages).to match(/\n <tns:authenticate/)
|
547
540
|
end
|
548
541
|
end
|
549
542
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Savon::RequestLogger do
|
4
|
+
|
5
|
+
subject { described_class.new(globals) }
|
6
|
+
let(:globals) { Savon::GlobalOptions.new(:log => true, :pretty_print_xml => true) }
|
7
|
+
let(:request) {
|
8
|
+
stub('Request',
|
9
|
+
:url => 'http://example.com',
|
10
|
+
:headers => [],
|
11
|
+
:body => '<TestRequest />'
|
12
|
+
)
|
13
|
+
}
|
14
|
+
|
15
|
+
let(:response) {
|
16
|
+
stub('Response',
|
17
|
+
:code => 200,
|
18
|
+
:body => '<TestResponse />'
|
19
|
+
)
|
20
|
+
}
|
21
|
+
|
22
|
+
before(:each) {
|
23
|
+
globals[:logger].level = Logger::DEBUG
|
24
|
+
}
|
25
|
+
|
26
|
+
describe '#log_request / #log_response' do
|
27
|
+
it 'does not prepare log messages when no logging is needed' do
|
28
|
+
begin
|
29
|
+
globals[:logger].level = Logger::FATAL
|
30
|
+
|
31
|
+
Savon::LogMessage.expects(:new).never
|
32
|
+
subject.log(request) { response }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: savon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Harrington
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nori
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: wasabi
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.
|
47
|
+
version: '3.4'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.
|
54
|
+
version: '3.4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: akami
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -293,6 +293,7 @@ files:
|
|
293
293
|
- spec/savon/operation_spec.rb
|
294
294
|
- spec/savon/options_spec.rb
|
295
295
|
- spec/savon/qualified_message_spec.rb
|
296
|
+
- spec/savon/request_logger_spec.rb
|
296
297
|
- spec/savon/request_spec.rb
|
297
298
|
- spec/savon/response_spec.rb
|
298
299
|
- spec/savon/soap_fault_spec.rb
|