webmock 3.9.1 → 3.9.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: 57c2c81fa3eb74334f703d9f92eb11cea8b06f1c70b713fdee1a071a90e99744
4
- data.tar.gz: 96798ebd031599d59d06ff8d2457af877ba6d4a7e9d20ef9e464396c9104bc2c
3
+ metadata.gz: 288c357fc347a74fb184fce39aa9aae6bd519efa26ed02a9d04f9f8fe3b85d47
4
+ data.tar.gz: 45b80da5db5b767f2ecf109bfcee71179f39607e313dfb0d633a2ed47c7d1dcd
5
5
  SHA512:
6
- metadata.gz: d6f0e72a1ecc925a006b9f781cb2e873a8dcafef0a6b80be74df2ad34bdb3eba0a9d02571f72fa825321da86d2a0afdbbdfb4b56e7c3b280bc1643b2acd76100
7
- data.tar.gz: 123fdca940fe7ea90b015cb6b085a063a00becef933df84335d1cf762780c12066590ab943c4cd5eba91bba4603f3663d4e8532ca374c036f5c0f306de03e28f
6
+ metadata.gz: 47f67ac72cf54bfe63b33d383deb69724cf5574bdf37204df96b708f822613b21893848716e93e29d92a79a22dfdb44280a59fb71c4933a2a0a9d97496c0c16c
7
+ data.tar.gz: e7f1ceaae61b7a29f81e5fc506477236a85ac5338f9fcf58ea41e0f66cfe2c7dbff40e2aedffba992901ac27139526cc9e43f41b7cf222e1ee02861aff78616d
@@ -1,8 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ # 3.9.2
4
+
5
+ * Made global stubs thread-safe
6
+
7
+ Thanks to [Adam Harwood](https://github.com/adam-harwood)
8
+
3
9
  # 3.9.1
4
10
 
5
- Fixed support for passing `URI` objects as second argument of `stub_request`
11
+ * Fixed support for passing `URI` objects as second argument of `stub_request`
6
12
 
7
13
  Thanks to [Ryan Kerr](https://github.com/leboshi)
8
14
 
@@ -28,11 +34,11 @@
28
34
 
29
35
  * Fixed async-http adapter which caused Async::HTTP::Client or Async::HTTP::Internet to hang and never return a response.
30
36
 
31
- Thanks to (Bruno Sutic)[https://github.com/bruno-] and [Samuel Williams](https://github.com/ioquatix)
37
+ Thanks to [Bruno Sutic](https://github.com/bruno-) and [Samuel Williams](https://github.com/ioquatix)
32
38
 
33
39
  * Fixed warning when using async-http adapter
34
40
 
35
- Thanks to (Bruno Sutic)[https://github.com/bruno-]
41
+ Thanks to [Bruno Sutic](https://github.com/bruno-)
36
42
 
37
43
  * Dropped support for Ruby 2.3 - EOL date: 2019-03-31
38
44
 
@@ -40,7 +46,7 @@
40
46
 
41
47
  * Handling matching of Addressable::Template patterns that have an ip address without port and patterns that have ip address and don’t have schema and path.
42
48
 
43
- Thanks to (Rafael França)[https://github.com/rafaelfranca] and (guppy0356)[https://github.com/guppy0356]
49
+ Thanks to [Rafael França](https://github.com/rafaelfranca) and [guppy0356](https://github.com/guppy0356)
44
50
 
45
51
  ## 3.8.3
46
52
 
data/README.md CHANGED
@@ -1137,6 +1137,7 @@ People who submitted patches and new features or suggested improvements. Many th
1137
1137
  * Lucas Uyezu
1138
1138
  * Bruno Sutic
1139
1139
  * Ryan Kerr
1140
+ * Adam Harwood
1140
1141
 
1141
1142
  For a full list of contributors you can visit the
1142
1143
  [contributors](https://github.com/bblimke/webmock/contributors) page.
@@ -23,10 +23,20 @@ module WebMock
23
23
  # That way, there's no race condition in case #to_return
24
24
  # doesn't run immediately after stub.with.
25
25
  responses = {}
26
+ response_lock = Mutex.new
26
27
 
27
28
  stub = ::WebMock::RequestStub.new(:any, ->(uri) { true }).with { |request|
28
- responses[request.object_id] = yield(request)
29
- }.to_return(lambda { |request| responses.delete(request.object_id) })
29
+ update_response = -> { responses[request.object_id] = yield(request) }
30
+
31
+ # The block can recurse, so only lock if we don't already own it
32
+ if response_lock.owned?
33
+ update_response.call
34
+ else
35
+ response_lock.synchronize(&update_response)
36
+ end
37
+ }.to_return(lambda { |request|
38
+ response_lock.synchronize { responses.delete(request.object_id) }
39
+ })
30
40
 
31
41
  global_stubs.push stub
32
42
  end
@@ -1,3 +1,3 @@
1
1
  module WebMock
2
- VERSION = '3.9.1' unless defined?(::WebMock::VERSION)
2
+ VERSION = '3.9.2' unless defined?(::WebMock::VERSION)
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.1
4
+ version: 3.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartosz Blimke
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-14 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -407,11 +407,11 @@ licenses:
407
407
  - MIT
408
408
  metadata:
409
409
  bug_tracker_uri: https://github.com/bblimke/webmock/issues
410
- changelog_uri: https://github.com/bblimke/webmock/blob/v3.9.1/CHANGELOG.md
411
- documentation_uri: https://www.rubydoc.info/gems/webmock/3.9.1
412
- source_code_uri: https://github.com/bblimke/webmock/tree/v3.9.1
410
+ changelog_uri: https://github.com/bblimke/webmock/blob/v3.9.2/CHANGELOG.md
411
+ documentation_uri: https://www.rubydoc.info/gems/webmock/3.9.2
412
+ source_code_uri: https://github.com/bblimke/webmock/tree/v3.9.2
413
413
  wiki_uri: https://github.com/bblimke/webmock/wiki
414
- post_install_message:
414
+ post_install_message:
415
415
  rdoc_options: []
416
416
  require_paths:
417
417
  - lib
@@ -427,7 +427,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
427
427
  version: '0'
428
428
  requirements: []
429
429
  rubygems_version: 3.1.2
430
- signing_key:
430
+ signing_key:
431
431
  specification_version: 4
432
432
  summary: Library for stubbing HTTP requests in Ruby.
433
433
  test_files: