artirix_data_models 0.31.0 → 0.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/artirix_data_models/cache_service.rb +1 -0
- data/lib/artirix_data_models/spec_support/gateway_mock.rb +28 -19
- data/lib/artirix_data_models/spec_support/shared_examples/an_artirix_data_model_dao.rb +1 -1
- data/lib/artirix_data_models/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: 68ae21ecebbb6e23b0e20e3cc9aed1dfbe0932ea
|
4
|
+
data.tar.gz: d9e1ff08adcb57dee94cea2b69cabde6483d8451
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2adcab677b934257e58d7579a4b65ef46b97033b6b1caf8b16e86f2bbd07dd1cf7acd503c0d46488669f9d073ab7c6614694783280200976f37b29cb179d43e
|
7
|
+
data.tar.gz: c2f3b98d7b7d9a7c1e4eb428edc936083bb754d965a3a021a818d9a8054b87b3f8b74f16dc818c6cc42c2cfb4c3a32a70f113839413aff3e3aff13957be1409d
|
data/README.md
CHANGED
@@ -34,6 +34,7 @@ module ArtirixDataModels::CacheService
|
|
34
34
|
def self.set_options_from_config(service)
|
35
35
|
options = ArtirixDataModels.configuration.try(:cache_options)
|
36
36
|
if options
|
37
|
+
options = options.to_hash if options.respond_to?(:to_hash) && !options.respond_to?(:each)
|
37
38
|
options.each do |name, opts|
|
38
39
|
if name.to_s == 'default_options'
|
39
40
|
service.register_default_options opts
|
@@ -16,7 +16,8 @@ def given_gateway_config(connection_url = nil)
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
# returns the result of `expect(gateway).to EXPECTATION` or `allow(gateway).to EXPECTATION`
|
20
|
+
# yields EXPECTATION so it can be tuned, for example to add a `at_most` call to the chain
|
20
21
|
def mock_gateway_response(response:,
|
21
22
|
method:,
|
22
23
|
path:,
|
@@ -26,25 +27,33 @@ def mock_gateway_response(response:,
|
|
26
27
|
authorization_bearer: nil,
|
27
28
|
authorization_token_hash: nil,
|
28
29
|
gateway: nil,
|
29
|
-
headers: nil
|
30
|
+
headers: nil,
|
31
|
+
expect: false,
|
32
|
+
&block)
|
30
33
|
gateway ||= ArtirixDataModels::DAORegistry.gateway
|
31
34
|
|
35
|
+
callable = block_given? ? block : ->(x) { x }
|
36
|
+
|
37
|
+
unless body.nil? || !json_body
|
38
|
+
body = body.kind_of?(String) ? body : body.to_json
|
39
|
+
end
|
40
|
+
|
32
41
|
params_hash = {
|
33
|
-
path:
|
34
|
-
body:
|
35
|
-
json_body:
|
36
|
-
timeout:
|
37
|
-
authorization_bearer:
|
42
|
+
path: path,
|
43
|
+
body: body,
|
44
|
+
json_body: json_body,
|
45
|
+
timeout: timeout,
|
46
|
+
authorization_bearer: authorization_bearer,
|
38
47
|
authorization_token_hash: authorization_token_hash,
|
39
|
-
headers:
|
48
|
+
headers: headers
|
40
49
|
}
|
41
50
|
|
42
|
-
|
51
|
+
what_to_allow = callable.call(receive(:perform).with(method, params_hash).and_return(response))
|
43
52
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
allow(gateway).to
|
53
|
+
if expect
|
54
|
+
expect(gateway).to what_to_allow
|
55
|
+
else
|
56
|
+
allow(gateway).to what_to_allow
|
48
57
|
end
|
49
58
|
end
|
50
59
|
|
@@ -61,13 +70,13 @@ def mock_gateway_not_found_response(method:,
|
|
61
70
|
gateway ||= ArtirixDataModels::DAORegistry.gateway
|
62
71
|
|
63
72
|
params_hash = {
|
64
|
-
path:
|
65
|
-
body:
|
66
|
-
json_body:
|
67
|
-
timeout:
|
68
|
-
authorization_bearer:
|
73
|
+
path: path,
|
74
|
+
body: body,
|
75
|
+
json_body: json_body,
|
76
|
+
timeout: timeout,
|
77
|
+
authorization_bearer: authorization_bearer,
|
69
78
|
authorization_token_hash: authorization_token_hash,
|
70
|
-
headers:
|
79
|
+
headers: headers
|
71
80
|
}
|
72
81
|
|
73
82
|
allow(gateway).to receive(:perform).with(method, params_hash).and_raise ArtirixDataModels::DataGateway::NotFound
|
@@ -98,7 +98,7 @@ shared_examples_for 'an ArtirixDataModel DAO' do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
Given do
|
101
|
-
allow(
|
101
|
+
allow(subject.dao_registry).to receive(:get).with(:model_fields).and_return(model_fields_dao)
|
102
102
|
end
|
103
103
|
|
104
104
|
When(:result) { subject.partial_mode_fields }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artirix_data_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Turiño
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|