convenient_service 0.10.0 → 0.10.1

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: 9ae92003a48bd04299fc7d8d6036c3d1c94e1a0e2a436c645969350bc3653a6a
4
- data.tar.gz: 177c46a70660b06e1985c4653cfc2ade49c07e9353880847c19b41e5017d3a05
3
+ metadata.gz: bea27107b54aa89400ea5c24d48db2087287b5c4d4aea9bdf3f860dc626bf864
4
+ data.tar.gz: 58a10038fa38887094a47b7dc00745244ac9ce0ef8daa5d1afa1fc8fd6ef893f
5
5
  SHA512:
6
- metadata.gz: 80e69d94ebbd681b3d9aaabd78367b3a104e3e452b596c5cfbf3b32ee6a2855b1352712ee0645c095eed9e66fdd6337be27ff2b9eb14bebf61166314db3d7d40
7
- data.tar.gz: 28bea96a05480a11360d261b853039fbc7fd364a2a495280cc457e083d62271b66ed861f089a9ad0172910976cfa1326c53a599fb2bf91ebbca68bba5e688e14
6
+ metadata.gz: faade4af5c03737c1954bfba9cbd9eaa5e31b13856e527cfcfb6e05db3f645729b81b65be8ed22e5f678845b1c3024224b9fe42eccb0bc3b27ed24ae5d8a2dec
7
+ data.tar.gz: 55fef97517812e04cf89eed571570728fd9a9f1ba2504422e3399600d5d71e27cc2723ced664b1eed147f0289b1cf0d0963805c8ffed45c0dfc173f0b4646505
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.1](https://github.com/marian13/convenient_service/compare/v0.10.0...v0.10.1) (2023-03-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **can_have_stubbed_result:** add thread-safety ([1962dcc](https://github.com/marian13/convenient_service/commit/1962dccdea29fb36c1b581e312329f41bb23c179))
9
+
3
10
  ## [0.10.0](https://github.com/marian13/convenient_service/compare/v0.9.0...v0.10.0) (2023-03-01)
4
11
 
5
12
 
@@ -22,7 +22,24 @@ module ConvenientService
22
22
  def stubbed_results
23
23
  return Support::Cache.new unless Support::Gems::RSpec.current_example
24
24
 
25
- cache = Utils::Object.instance_variable_fetch(::RSpec.current_example, :@__convenient_service_stubbed_results__) { Support::Cache.new }
25
+ ##
26
+ # IMPORTANT: ivar name with class and current thread enforces thread safety since there is no resource to share.
27
+ #
28
+ # TODO: Thread safety specs.
29
+ #
30
+ # NOTE: `self` is a service class in the current context. For example:
31
+ #
32
+ # before do
33
+ # stub_service(ConvenientService::Examples::Standard::Gemfile::Services::RunShell)
34
+ # .with_arguments(command: node_available_command)
35
+ # .to return_result(node_available_status)
36
+ # end
37
+ #
38
+ # # Then `self` is `ConvenientService::Examples::Standard::Gemfile::Services::RunShell`.
39
+ #
40
+ ivar_name = "@__convenient_service_stubbed_results__#{object_id}__#{Thread.current.object_id}__"
41
+
42
+ cache = Utils::Object.instance_variable_fetch(::RSpec.current_example, ivar_name) { Support::Cache.new }
26
43
 
27
44
  cache.scope(self)
28
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ConvenientService
4
- VERSION = "0.10.0"
4
+ VERSION = "0.10.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convenient_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marian Kostyk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal