service_contract 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/service_contract/assertions.rb +5 -5
- data/lib/service_contract/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: c79089bb4c45ecaf89930c3812b31434739a80ef
|
4
|
+
data.tar.gz: 77e970ad260efe58fb4b2bd084bedce070a43305
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9394895b5246c3ec59b2523b58dce7a88389a90b0c6b00ff62cd63987c6e8c4b838b11145ad4113c5cdf94cc6c358d106516eaf27d87a5f903b3a1a3c50ed4f
|
7
|
+
data.tar.gz: f8f775dd3f259e8fb7a1d0ea5108c4b645905205784e6e0815d9a0a19261fefb36a0b84843b773f324746ae031fd13fd25a62fa0e6a0fc28ed4123455b4dfaee
|
data/CHANGELOG.md
CHANGED
@@ -2,21 +2,21 @@ module ServiceContract
|
|
2
2
|
module Assertions
|
3
3
|
|
4
4
|
def assert_endpoint_response(data, endpoint, allow_nil = true)
|
5
|
-
assert_data_matches_type(data, endpoint.response_type, allow_nil)
|
5
|
+
assert_data_matches_type(data, endpoint.response_type, endpoint.name, allow_nil)
|
6
6
|
end
|
7
7
|
|
8
|
-
def assert_data_matches_type(data, type, allow_nil = true)
|
8
|
+
def assert_data_matches_type(data, type, name, allow_nil = true)
|
9
9
|
# Skip out if object is nil and allowed to be nil
|
10
10
|
return true if data.nil? && allow_nil
|
11
11
|
|
12
12
|
# basic type checking
|
13
|
-
assert type.valid_type?(data), "expected `#{data}` (#{
|
13
|
+
assert type.valid_type?(data), "expected `#{data}` (#{name}) to be one of #{type.valid_ruby_types}, instead got a #{data.class.name}"
|
14
14
|
assert type.valid_value?(data), "#{data} is not an allowed value of type: #{type.name}"
|
15
15
|
|
16
16
|
# check subtype
|
17
17
|
if type.subtype
|
18
18
|
data.each do |datum|
|
19
|
-
assert_data_matches_type(datum, type.subtype, allow_nil)
|
19
|
+
assert_data_matches_type(datum, type.subtype, type.name, allow_nil)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -34,7 +34,7 @@ module ServiceContract
|
|
34
34
|
end
|
35
35
|
|
36
36
|
# check the data type
|
37
|
-
assert_data_matches_type(value, field.type, allow_nil)
|
37
|
+
assert_data_matches_type(value, field.type, field.name, allow_nil)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: service_contract
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Ching
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro
|