sus-fixtures-async-http 0.1.0 → 0.1.1

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: 1716b4f27d91b40199835a2c12cefc8e41b731ed0fa0546ba1462077a5146896
4
- data.tar.gz: 8f6246a78b59bf3f992c4cd9c6a1573e913f69aff6a100b3f6c095c536357d9d
3
+ metadata.gz: 0c4568feda15d16a682baae23527d0cfde7a9a1d95c50b5a19796d7bf13c81e4
4
+ data.tar.gz: 78b17af438acaddcb8e0f1dbbfcd10071ae6d7335402eab80f3b0db708ed542d
5
5
  SHA512:
6
- metadata.gz: 9835755194d42cc88b071ae3a24540717daf760991a24b9c4a228882930dc408b535cee524d3a595bbf1fe639038b1b0c97bf98e83c4096821457394a2e29586
7
- data.tar.gz: 962151af4106d8d605fa5f4f74e137e3f7a742788383a51d550cc046948bb1dc99d7dfd0238133acf6684c800197fa14d8f1a9e45a4213ffe631dc7a730b7b21
6
+ metadata.gz: f837069655f254e1c39f39207b43b8f5a7b6ea783b4f4c2b5ebde1d55fb8d6a1b5cf6fc1c21d764b99cc323340b49d6bdcc77726983498e7c3d11d624f14e4ae
7
+ data.tar.gz: bb78cb2f2d7ee560f67a2db190718f8e10c507de8aa5faa2d2612df2f888fac82d893f08fb2d572a0f4b30ae02216cf02ce5ac0502bb4a0fb52ed5face36aa56
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,22 +1,5 @@
1
- # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # Copyright, 2022, by Samuel Williams.
2
+ # Released under the MIT License.
20
3
 
21
4
  require 'sus/fixtures/async/reactor_context'
22
5
 
@@ -25,59 +8,63 @@ require 'async/http/client'
25
8
  require 'async/http/endpoint'
26
9
  require 'async/io/shared_endpoint'
27
10
 
28
- module Sus::Fixtures::Async
29
- module HTTP::ServerContext
30
- include ReactorContext
31
-
32
- def protocol
33
- Async::HTTP::Protocol::HTTP1
34
- end
35
-
36
- def endpoint
37
- Async::HTTP::Endpoint.parse('http://127.0.0.1:9294', timeout: 0.8, reuse_port: true, protocol: protocol)
38
- end
39
-
40
- def retries
41
- 1
42
- end
43
-
44
- def app
45
- Protocol::HTTP::Middleware::HelloWorld
46
- end
47
-
48
- def middleware
49
- app
50
- end
51
-
52
- def server
53
- Async::HTTP::Server.new(middleware, @bound_endpoint)
54
- end
55
-
56
- def client
57
- @client
58
- end
59
-
60
- def before
61
- # We bind the endpoint before running the server so that we know incoming connections will be accepted:
62
- @bound_endpoint = Async::IO::SharedEndpoint.bound(endpoint)
63
-
64
- # I feel a dedicated class might be better than this hack:
65
- mock(@bound_endpoint) do |mock|
66
- mock.replace(:protocol) {endpoint.protocol}
67
- mock.replace(:scheme) {endpoint.scheme}
11
+ module Sus::Fixtures
12
+ module Async
13
+ module HTTP
14
+ module ServerContext
15
+ include ReactorContext
16
+
17
+ def protocol
18
+ ::Async::HTTP::Protocol::HTTP1
19
+ end
20
+
21
+ def endpoint
22
+ ::Async::HTTP::Endpoint.parse('http://127.0.0.1:9294', timeout: 0.8, reuse_port: true, protocol: protocol)
23
+ end
24
+
25
+ def retries
26
+ 1
27
+ end
28
+
29
+ def app
30
+ ::Protocol::HTTP::Middleware::HelloWorld
31
+ end
32
+
33
+ def middleware
34
+ app
35
+ end
36
+
37
+ def server
38
+ ::Async::HTTP::Server.new(middleware, @bound_endpoint)
39
+ end
40
+
41
+ def client
42
+ @client
43
+ end
44
+
45
+ def before
46
+ # We bind the endpoint before running the server so that we know incoming connections will be accepted:
47
+ @bound_endpoint = ::Async::IO::SharedEndpoint.bound(endpoint)
48
+
49
+ # I feel a dedicated class might be better than this hack:
50
+ mock(@bound_endpoint) do |mock|
51
+ mock.replace(:protocol) {endpoint.protocol}
52
+ mock.replace(:scheme) {endpoint.scheme}
53
+ end
54
+
55
+ @server_task = Async do
56
+ server.run
57
+ end
58
+
59
+ @client = ::Async::HTTP::Client.new(endpoint, protocol: endpoint.protocol, retries: retries)
60
+ end
61
+
62
+ def after
63
+ @client&.close
64
+ @server_task&.stop
65
+ @bound_endpoint&.close
66
+ end
68
67
  end
69
-
70
- @server_task = Async do
71
- server.run
72
- end
73
-
74
- @client = Async::HTTP::Client.new(endpoint, protocol: endpoint.protocol, retries: retries)
75
- end
76
-
77
- def after
78
- @client&.close
79
- @server_task&.stop
80
- @bound_endpoint&.close
81
68
  end
82
69
  end
83
70
  end
@@ -1,29 +1,12 @@
1
- # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # Copyright, 2022, by Samuel Williams.
2
+ # Released under the MIT License.
20
3
 
21
- module Sus
22
- module Fixtures
23
- module Async
24
- module HTTP
25
- VERSION = "0.1.0"
26
- end
4
+ require 'sus/fixtures'
5
+
6
+ module Sus::Fixtures
7
+ module Async
8
+ module HTTP
9
+ VERSION = "0.1.1"
27
10
  end
28
11
  end
29
12
  end
@@ -1 +1,5 @@
1
+ # Copyright, 2022, by Samuel Williams.
2
+ # Released under the MIT License.
3
+
1
4
  require_relative 'http/server_context'
5
+ require_relative 'http/version'
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.1.0
4
+ version: 0.1.1
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: 2022-08-24 00:00:00.000000000 Z
40
+ date: 2022-08-25 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: sus
@@ -76,8 +76,6 @@ files:
76
76
  - lib/sus/fixtures/async/http.rb
77
77
  - lib/sus/fixtures/async/http/server_context.rb
78
78
  - lib/sus/fixtures/async/http/version.rb
79
- - license.md
80
- - readme.md
81
79
  homepage: https://github.com/ioquatix/sus-fixtures-async
82
80
  licenses:
83
81
  - MIT
metadata.gz.sig CHANGED
Binary file
data/license.md DELETED
@@ -1,21 +0,0 @@
1
- # MIT License
2
-
3
- Copyright, 2022, by Samuel Williams.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/readme.md DELETED
@@ -1,21 +0,0 @@
1
- # Sus::Fixtures::Async::HTTP
2
-
3
- Provides a convenient fixture for running a web server.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- $ bundle add sus-fixtures-async-http
9
- ```
10
-
11
- ## Usage
12
-
13
- ```ruby
14
- include Sus::Fixtures::Async::HTTP::ServerContext
15
-
16
- let(:response) {client.get("/")}
17
-
18
- it 'can perform a reqeust' do
19
- expect(response.read).to be == "Hello World!"
20
- end
21
- ```