soaspec 0.0.47 → 0.0.48
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.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/Gemfile.lock +1 -1
- data/config/data/default.yml +1 -1
- data/lib/soaspec/exchange.rb +1 -1
- data/lib/soaspec/exchange_handlers/rest_handler.rb +1 -1
- data/lib/soaspec/exchange_handlers/soap_handler.rb +2 -2
- data/lib/soaspec/matchers.rb +3 -12
- data/lib/soaspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d66f4dd1240984bed39579008a20ca1c08127b52
|
4
|
+
data.tar.gz: bb11a11eb0d9c6d51ad10f6f95a181c2eea2d572
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fe6dfb9d15a1357929a447b1f02d2dd88703880ed22310df523a309c1d487c583101253f212012dc7aae7a1df1d278d374dd65bd4169223ecd086863935c16a
|
7
|
+
data.tar.gz: 05d5655a71a73503dfa09b511a6bff38bd906fb4079e604b28b23a57b045dd5d7bb5940e9083ed7e46f9051a1b076dc7c9a15b5f3dba983c56e82fea484223fe
|
data/ChangeLog
CHANGED
data/Gemfile.lock
CHANGED
data/config/data/default.yml
CHANGED
data/lib/soaspec/exchange.rb
CHANGED
@@ -95,7 +95,7 @@ class Exchange
|
|
95
95
|
# @param [Object] path Path to return element for api class E.g - for SOAP this is XPath string. For JSON, this is Hash dig Array
|
96
96
|
# @return [String] Value at path
|
97
97
|
def [](path)
|
98
|
-
@api_class.value_from_path(response, path)
|
98
|
+
@api_class.value_from_path(response, path.to_s)
|
99
99
|
end
|
100
100
|
|
101
101
|
end
|
@@ -222,7 +222,7 @@ module Soaspec
|
|
222
222
|
|
223
223
|
# Based on a exchange, return the value at the provided xpath
|
224
224
|
# If the path does not begin with a '/', a '//' is added to it
|
225
|
-
# @param [
|
225
|
+
# @param [Response] response
|
226
226
|
# @param [Object] path Xpath, JSONPath or other path identifying how to find element
|
227
227
|
# @return [String] Value at Xpath
|
228
228
|
def value_from_path(response, path)
|
@@ -155,13 +155,13 @@ module Soaspec
|
|
155
155
|
raise ArgumentError unless response && xpath
|
156
156
|
result =
|
157
157
|
if Soaspec.strip_namespaces? && !xpath.include?(':')
|
158
|
-
temp_doc = response.doc
|
158
|
+
temp_doc = response.doc.dup
|
159
159
|
temp_doc.remove_namespaces!
|
160
160
|
temp_doc.xpath(xpath).first
|
161
161
|
else
|
162
162
|
response.xpath(xpath).first
|
163
163
|
end
|
164
|
-
raise NoElementAtPath, "No value at Xpath '#{xpath}'" unless result
|
164
|
+
raise NoElementAtPath, "No value at Xpath '#{xpath}' in XML #{response.doc}" unless result
|
165
165
|
result.inner_text
|
166
166
|
end
|
167
167
|
|
data/lib/soaspec/matchers.rb
CHANGED
@@ -26,29 +26,20 @@ RSpec::Matchers.define :include_in_body do |expected|
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
# Whether expected element exists in body
|
30
|
-
RSpec::Matchers.define :contain_key do |path|
|
31
|
-
match do |actual|
|
32
|
-
expect(actual).to have_element_at_path path
|
33
|
-
end
|
34
|
-
|
35
|
-
failure_message do |actual|
|
36
|
-
"expected that #{actual.api_class.response_body(actual.response, format: :hash)} would contain key #{path}"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
29
|
# Whether an element exists at expected xpath
|
41
30
|
RSpec::Matchers.define :have_element_at_path do |xpath|
|
42
31
|
match do |exchange|
|
43
32
|
expect { exchange[xpath] }.to_not raise_error # Error will be raised if Path returns no value
|
44
33
|
end
|
45
34
|
|
35
|
+
# TODO: Would be better to print failure message
|
46
36
|
failure_message do |actual|
|
47
|
-
"expected that #{actual.api_class.response_body(actual.response, format: :raw)} would have element at
|
37
|
+
"expected that #{actual.api_class.response_body(actual.response, format: :raw)} would have element at path '#{xpath}'"
|
48
38
|
end
|
49
39
|
end
|
50
40
|
|
51
41
|
RSpec::Matchers.alias_matcher :have_element_at_xpath, :have_element_at_path
|
42
|
+
RSpec::Matchers.alias_matcher :contain_key, :have_element_at_path
|
52
43
|
|
53
44
|
# Whether an element at xpath (defined by key) has value (defined by value).
|
54
45
|
# @param [Hash] expected_hash Xpath => Value pair (e.g. '//xmlns:GetWeatherResult' => 'Data Not Found')
|
data/lib/soaspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soaspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.48
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|