corindon 0.7.1 → 0.7.2

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
  SHA256:
3
- metadata.gz: cca83eddfe861552adada0fd1f570d4fe8cb4ae9621be1b8ba183f4ce75d2e0a
4
- data.tar.gz: a4f6192afef7522bc45be5a3b448b1366a1e18cc6318b8dd95e7e88021b12070
3
+ metadata.gz: 9899f5321cf96c41569182938051a815f5baed7d04bda1f88a649c21b50df0b3
4
+ data.tar.gz: c6a9495fc8c46760fb5a09780bc8bbc12ae95deb4e0d7331042f7640f0d380d7
5
5
  SHA512:
6
- metadata.gz: 64b64ba2e60584ccf94737cae4770f972a45ef72ba3421f7131f1727cff2da7b6b2001537f6d054338a3a3edb9941a0655dff0d00eeaf2c85c0bd64e0ebd7da0
7
- data.tar.gz: fc7a43a1ff7490622cb87c49805957b6a8b1e0ce488e64bc9cc23f2edb75f135f0d50bc376b128f88a3b01965d3cdc8a84c7b87a8918991eeb6aca9505db1fc4
6
+ metadata.gz: 66590e780392422933ccceb3596bb9e97d4ef6eb9e4d5685847cfe128b5f5d0a196723aa626f5bab711b011dad84a5987fc2b1946dd850b0e255226308bdd18a
7
+ data.tar.gz: bd262475a0fa7d10b565ef357d066db7b94c310eff89188438683ff26322de2fb5bcf87398b676ded30ef0fac18c81d251cb0c0f217ed20208bd02ba96a0629e
@@ -10,11 +10,30 @@ module Corindon
10
10
  # @param [Definition] definition
11
11
  # @param [Object] value
12
12
  def mock_definition(definition, value)
13
+ singleton_class.prepend MockUtils unless is_a?(MockUtils)
14
+
13
15
  add_definition(definition) if !has?(definition)
14
16
 
15
- services[to_id(definition)] = value
17
+ id = to_id(definition)
18
+ mocks[definition] = services[id] = value
16
19
  end
17
20
  end
21
+
22
+ using self
23
+
24
+ def mocks
25
+ @mocks ||= {}
26
+ end
27
+
28
+ def dup
29
+ new_instance = super
30
+
31
+ mocks.each do |definition, value|
32
+ new_instance.mock_definition(definition, value)
33
+ end
34
+
35
+ new_instance
36
+ end
18
37
  end
19
38
  end
20
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Corindon
4
- VERSION = '0.7.1'
4
+ VERSION = '0.7.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corindon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémi Piotaix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2021-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic