soaspec 0.0.47 → 0.0.48

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 687a34b22e83e1010cf5619a8abbe2279b15954f
4
- data.tar.gz: be4f8c9f0f1732e3cb416aa9f812f537330af1a0
3
+ metadata.gz: d66f4dd1240984bed39579008a20ca1c08127b52
4
+ data.tar.gz: bb11a11eb0d9c6d51ad10f6f95a181c2eea2d572
5
5
  SHA512:
6
- metadata.gz: 5f3c5fd3b00ba6e174aaef074770f6b1f4623f6744137e58dc204bca86f8406d9a94a26fd4f7a10c5f73c40f53ef8dca8ebb890656633b3fd628e76ecc6f6b03
7
- data.tar.gz: b9bea7f0d4ec52d9d580a249d7fe3492484c784e1c1d9661a79c8e9113bbec126d1b627e278421eddce9edea430b7189b85534a592dee43ea808b98dd0fd1434
6
+ metadata.gz: 5fe6dfb9d15a1357929a447b1f02d2dd88703880ed22310df523a309c1d487c583101253f212012dc7aae7a1df1d278d374dd65bd4169223ecd086863935c16a
7
+ data.tar.gz: 05d5655a71a73503dfa09b511a6bff38bd906fb4079e604b28b23a57b045dd5d7bb5940e9083ed7e46f9051a1b076dc7c9a15b5f3dba983c56e82fea484223fe
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.0.47
2
+ * Bug Fix
3
+ * Using 'Strip namespace' handle both namespace or not dependent if used
4
+
1
5
  Version 0.0.47
2
6
  * Enhancements
3
7
  * 'success scenarios' shared eg and 'retry_for_success' exchange method's status codes include 200..299, not just 200.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- soaspec (0.0.47)
4
+ soaspec (0.0.48)
5
5
  jsonpath
6
6
  rest-client (>= 2.0)
7
7
  rspec (~> 3.0)
@@ -2,7 +2,7 @@ small_id:
2
2
  blz: 100
3
3
 
4
4
  pet:
5
- id: '1122334400'
5
+ id: '11223344090'
6
6
  category:
7
7
  id: '1'
8
8
  name: 'string'
@@ -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 [Exchange] exchange
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
 
@@ -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 xpath '#{xpath}'"
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')
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.0.47'
2
+ VERSION = '0.0.48'
3
3
  end
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.47
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-10 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler