webspicy 0.20.1 → 0.20.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 576301cb14f9cc4abcb10c8638e7b7994397e3bd91c0f3e48fea49ff356dc81d
4
- data.tar.gz: e19dc03f7daa686ec2c97f9f83b28249a7ccf16de852b5844bf68cf99291944e
3
+ metadata.gz: '0039cf2e5ebbb990cc29c6ed76e4eabf941feeb031f4761d30e120f32e31a41f'
4
+ data.tar.gz: c743e9f1650e7d9a09bef50d54e2e35e261761b085456d4bd8b4f7a6060f5304
5
5
  SHA512:
6
- metadata.gz: e85cdd2ad61ed8b3e4a7d0362cd6543d6107ff4bbdba3586a3145c911e6d76d17a96347c28b56283804979ffea0a33ab47ba5426074450bc25b51ad78819c316
7
- data.tar.gz: 3eb380f55e3f444f0cdd4268c00ef434b6f68ccca8cb10a3486be837a3d096dfd929d23b69d8ab872929995532491b9e3e41f1d44e2bff71ab078df10324a660
6
+ metadata.gz: d9a039f3919a201378847ab7db291dcd72a345d594d11900e941f65c6c9e211825851778c4dea9969c2dc1ed88d80ae177af03f977e9437eba15471acd111127
7
+ data.tar.gz: 61347ee21583f15bb966e279221604fe6b7f89c2a2833bc7dfa92d062ff238b2f26949b89674c97eb651d09d435610d5bf5689bf8596b4ed75a6ea4e4a1a981c
@@ -10,11 +10,14 @@ module Webspicy
10
10
  attr_reader :target
11
11
 
12
12
  def instrument
13
+ return unless target.respond_to?(:instrument)
13
14
  target.instrument(test_case, client)
14
15
  end
15
16
 
16
17
  def check!
17
- target.check(invocation)
18
+ return unless target.respond_to?(:check)
19
+ res = target.check(invocation)
20
+ res ? fail!(res) : nil
18
21
  end
19
22
 
20
23
  def to_s
@@ -10,6 +10,9 @@ module Webspicy
10
10
  end
11
11
  attr_accessor :specification
12
12
 
13
+ # Deprecated
14
+ alias :resource :specification
15
+
13
16
  def self.info(raw)
14
17
  new(raw)
15
18
  end
@@ -28,6 +28,9 @@ module Webspicy
28
28
  service.specification
29
29
  end
30
30
 
31
+ # Deprecated
32
+ alias :resource :specification
33
+
31
34
  def self.info(raw)
32
35
  new(raw)
33
36
  end
@@ -61,6 +61,11 @@ module Webspicy
61
61
  end
62
62
  end
63
63
 
64
+ def bind_condition(c)
65
+ c = Specification::Oldies::Bridge.new(c) unless c.respond_to?(:bind)
66
+ c.bind(self)
67
+ end
68
+
64
69
  protected
65
70
 
66
71
  def run_config
@@ -176,7 +181,7 @@ module Webspicy
176
181
  end
177
182
 
178
183
  def instrument_one(condition)
179
- condition.bind(self).instrument
184
+ bind_condition(condition).instrument
180
185
  rescue ArgumentError
181
186
  raise "#{condition.class} implements old PRE/POST contract"
182
187
  end
@@ -40,7 +40,7 @@ module Webspicy
40
40
  actual_size(target, path) == expected
41
41
  end
42
42
 
43
- def actual_size(target, path)
43
+ def actual_size(target, path)
44
44
  target = extract_path(target, path)
45
45
  respond_to!(target, :size).size
46
46
  end
@@ -68,7 +68,7 @@ module Webspicy
68
68
  an_array(target).find { |t| t[:id] == id }
69
69
  end
70
70
 
71
- def idFD(element, expected)
71
+ def idFD(element, expected)
72
72
  expected.keys.all? do |k|
73
73
  value_equal(expected[k], element[k])
74
74
  end
@@ -96,13 +96,13 @@ module Webspicy
96
96
 
97
97
  def check_postconditions!
98
98
  service.postconditions.each do |c|
99
- check_one! Result::PostconditionMet.new(self, c.bind(tester))
99
+ check_one! Result::PostconditionMet.new(self, tester.bind_condition(c))
100
100
  end
101
101
  end
102
102
 
103
103
  def check_errconditions!
104
104
  service.errconditions.each do |c|
105
- check_one! Result::ErrconditionMet.new(self, c.bind(tester))
105
+ check_one! Result::ErrconditionMet.new(self, tester.bind_condition(c))
106
106
  end
107
107
  end
108
108
 
@@ -2,7 +2,7 @@ module Webspicy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 20
5
- TINY = 1
5
+ TINY = 2
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -53,6 +53,7 @@ module Webspicy
53
53
  alias :loaded_body :loaded_output
54
54
 
55
55
  def output
56
+ return loaded_output unless is_structured_output?
56
57
  schema = is_expected_success? ? service.output_schema : service.error_schema
57
58
  begin
58
59
  schema.dress(loaded_output)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webspicy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau