sus-fixtures-async-http 0.3.0 → 0.4.0

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: dd3f410d2f916037112c74ffc5b4c84f60f1c88412e8d0bf687667cc6c005a82
4
- data.tar.gz: cc7177359a1732b55cbbb6ecb67d2b0f83de0b288a5dafe501b05e71f484f506
3
+ metadata.gz: 37b083cf427b4788520de2955f48e1ce9025a361f3e5c92aaf534fb455db47b8
4
+ data.tar.gz: a0afbc0322271a71d7ca8c2ae916fb3591db006b3614991e4f850262c6a362fb
5
5
  SHA512:
6
- metadata.gz: 7f80fed8f250fb0068320ccdb4127c53ccaab56b837123636b858abfcd64273fd0c9e27e55b7be77f2c787894f84e88517568f438a4d82f425288f3f6411cda3
7
- data.tar.gz: 5a6e3d62afe002b99ab2921ed157733fbd1353b865b9d066ec1c606a4d92c0dd6e03d6e3f01352a0d50f1d6fa2d0e4ae4ef77b8a84c7f77bcd808d619a83b8ed
6
+ metadata.gz: f7634e13a74f666d2e6f7e360d204471a7dcc83bbd412cd00ee33110be84038f8f582ba3f2dec28f80e5355c1f8e10d3fcb082ff6a4856078093c23ec6820676
7
+ data.tar.gz: 35526b7e3c8f7260dafa66d0da738253cf5945b23fd950633525f8beb411070871c60ec9b4f034564ec6c4c9d1ee02b146d96b2f8f4e107cd22b0dab043d7378
checksums.yaml.gz.sig CHANGED
Binary file
@@ -65,10 +65,18 @@ module Sus::Fixtures
65
65
  app
66
66
  end
67
67
 
68
- def server
68
+ def make_server_endpoint(bound_endpoint)
69
+ bound_endpoint
70
+ end
71
+
72
+ def make_server(endpoint)
69
73
  ::Async::HTTP::Server.new(middleware, @bound_endpoint)
70
74
  end
71
75
 
76
+ def server
77
+ @server
78
+ end
79
+
72
80
  def client
73
81
  @client
74
82
  end
@@ -77,31 +85,40 @@ module Sus::Fixtures
77
85
  @client_endpoint
78
86
  end
79
87
 
88
+ def make_client_endpoint(bound_endpoint)
89
+ bound_endpoint.local_address_endpoint
90
+ end
91
+
92
+
80
93
  def before
81
94
  super
82
95
 
83
96
  # We bind the endpoint before running the server so that we know incoming connections will be accepted:
84
97
  @bound_endpoint = ::Async::IO::SharedEndpoint.bound(endpoint)
85
- @client_endpoint = @bound_endpoint.local_address_endpoint
86
98
 
87
- # I feel a dedicated class might be better than this hack:
88
- mock(@bound_endpoint) do |mock|
89
- mock.replace(:protocol) {endpoint.protocol}
90
- mock.replace(:scheme) {endpoint.scheme}
99
+ @server_endpoint = make_server_endpoint(@bound_endpoint)
100
+ mock(@server_endpoint) do |wrapper|
101
+ wrapper.replace(:protocol) {endpoint.protocol}
102
+ wrapper.replace(:scheme) {endpoint.scheme}
103
+ wrapper.replace(:authority) {endpoint.authority}
104
+ wrapper.replace(:path) {endpoint.path}
91
105
  end
92
106
 
93
- mock(@client_endpoint) do |mock|
94
- mock.replace(:protocol) {endpoint.protocol}
95
- mock.replace(:scheme) {endpoint.scheme}
96
- mock.replace(:authority) {endpoint.authority}
97
- mock.replace(:path) {endpoint.path}
98
- end
107
+ @server = make_server(@server_endpoint)
99
108
 
100
109
  @server_task = Async do
101
- server.run
110
+ @server.run
111
+ end
112
+
113
+ @client_endpoint = make_client_endpoint(@bound_endpoint)
114
+ mock(@client_endpoint) do |wrapper|
115
+ wrapper.replace(:protocol) {endpoint.protocol}
116
+ wrapper.replace(:scheme) {endpoint.scheme}
117
+ wrapper.replace(:authority) {endpoint.authority}
118
+ wrapper.replace(:path) {endpoint.path}
102
119
  end
103
120
 
104
- @client = ::Async::HTTP::Client.new(@client_endpoint, protocol: endpoint.protocol, retries: retries)
121
+ @client = ::Async::HTTP::Client.new(@client_endpoint, retries: retries)
105
122
  end
106
123
 
107
124
  def after
@@ -7,7 +7,7 @@ module Sus
7
7
  module Fixtures
8
8
  module Async
9
9
  module HTTP
10
- VERSION = "0.3.0"
10
+ VERSION = "0.4.0"
11
11
  end
12
12
  end
13
13
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sus-fixtures-async-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -37,7 +37,7 @@ cert_chain:
37
37
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
38
38
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
39
  -----END CERTIFICATE-----
40
- date: 2023-02-10 00:00:00.000000000 Z
40
+ date: 2023-09-10 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: async-http
@@ -120,7 +120,7 @@ files:
120
120
  - lib/sus/fixtures/async/http/version.rb
121
121
  - license.md
122
122
  - readme.md
123
- homepage: https://github.com/ioquatix/sus-fixtures-async
123
+ homepage: https://github.com/socketry/sus-fixtures-async-http
124
124
  licenses:
125
125
  - MIT
126
126
  metadata:
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.4.6
143
+ rubygems_version: 3.4.10
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Test fixtures for running in Async::HTTP.
metadata.gz.sig CHANGED
Binary file