async-rspec 1.14.0 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async/rspec/ssl.rb +1 -1
- data/lib/async/rspec/version.rb +1 -1
- metadata +13 -21
- data/.editorconfig +0 -6
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/.travis.yml +0 -18
- data/Gemfile +0 -10
- data/README.md +0 -130
- data/Rakefile +0 -6
- data/async-rspec.gemspec +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aed11a0779ef93abfe812b506aea1fd4d043eaec11e895bcbb06498cb3a7d4da
|
4
|
+
data.tar.gz: 15b970c1a6e19b63c6671d9b1634757c956b33bfcaeb833172828836ecc157d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d63a0de1dac83380f1e3215637b5d2b02258d9b81060bfa31bc69aa43ef08c37fa1efdf133f796b5a6d9c16bdc49aebca9c9ea03b885cfda1ffecb82af50c14
|
7
|
+
data.tar.gz: 104cd0e2dc227b77ea861cee32f7fad898f3825ef5c95215b1fb51fc0d19f46621f6b505b88f8c75e780ac05087e5aeca59e41abba6c2ca4bfcbb86477a24acf
|
data/lib/async/rspec/ssl.rb
CHANGED
@@ -42,7 +42,7 @@ module Async
|
|
42
42
|
::RSpec.shared_context SSL::CertificateAuthority do
|
43
43
|
# This key size is generally considered insecure, but it's fine for testing.
|
44
44
|
let(:certificate_authority_key) {OpenSSL::PKey::RSA.new(1024)}
|
45
|
-
let(:certificate_authority_name) {OpenSSL::X509::Name.parse("O=
|
45
|
+
let(:certificate_authority_name) {OpenSSL::X509::Name.parse("O=TestCA/CN=localhost")}
|
46
46
|
|
47
47
|
# The certificate authority is used for signing and validating the certificate which is used for communciation:
|
48
48
|
let(:certificate_authority) do
|
data/lib/async/rspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec-
|
28
|
+
name: rspec-files
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec-
|
42
|
+
name: rspec-memory
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.24'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: covered
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -108,21 +108,12 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '10.0'
|
111
|
-
description:
|
111
|
+
description:
|
112
112
|
email:
|
113
|
-
- samuel.williams@oriontransfer.co.nz
|
114
113
|
executables: []
|
115
114
|
extensions: []
|
116
115
|
extra_rdoc_files: []
|
117
116
|
files:
|
118
|
-
- ".editorconfig"
|
119
|
-
- ".gitignore"
|
120
|
-
- ".rspec"
|
121
|
-
- ".travis.yml"
|
122
|
-
- Gemfile
|
123
|
-
- README.md
|
124
|
-
- Rakefile
|
125
|
-
- async-rspec.gemspec
|
126
117
|
- lib/async/rspec.rb
|
127
118
|
- lib/async/rspec/buffer.rb
|
128
119
|
- lib/async/rspec/leaks.rb
|
@@ -132,9 +123,10 @@ files:
|
|
132
123
|
- lib/async/rspec/ssl.rb
|
133
124
|
- lib/async/rspec/version.rb
|
134
125
|
homepage: https://github.com/socketry/async-rspec
|
135
|
-
licenses:
|
126
|
+
licenses:
|
127
|
+
- MIT
|
136
128
|
metadata: {}
|
137
|
-
post_install_message:
|
129
|
+
post_install_message:
|
138
130
|
rdoc_options: []
|
139
131
|
require_paths:
|
140
132
|
- lib
|
@@ -149,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
141
|
- !ruby/object:Gem::Version
|
150
142
|
version: '0'
|
151
143
|
requirements: []
|
152
|
-
rubygems_version: 3.
|
153
|
-
signing_key:
|
144
|
+
rubygems_version: 3.1.2
|
145
|
+
signing_key:
|
154
146
|
specification_version: 4
|
155
147
|
summary: Helpers for writing specs against the async gem.
|
156
148
|
test_files: []
|
data/.editorconfig
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
|
4
|
-
matrix:
|
5
|
-
include:
|
6
|
-
- rvm: 2.4
|
7
|
-
- rvm: 2.5
|
8
|
-
- rvm: 2.6
|
9
|
-
- rvm: 2.6
|
10
|
-
env: COVERAGE=BriefSummary,Coveralls
|
11
|
-
- rvm: ruby-head
|
12
|
-
- rvm: jruby-head
|
13
|
-
env: JRUBY_OPTS="--debug -X+O"
|
14
|
-
- rvm: truffleruby
|
15
|
-
allow_failures:
|
16
|
-
- rvm: ruby-head
|
17
|
-
- rvm: jruby-head
|
18
|
-
- rvm: truffleruby
|
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
# Async::RSpec
|
2
|
-
|
3
|
-
Provides useful `RSpec.shared_context`s for testing code that builds on top of [async].
|
4
|
-
|
5
|
-
[async]: https://github.com/socketry/async
|
6
|
-
|
7
|
-
[![Build Status](https://secure.travis-ci.org/socketry/async-rspec.svg)](http://travis-ci.org/socketry/async-rspec)
|
8
|
-
[![Code Climate](https://codeclimate.com/github/socketry/async-rspec.svg)](https://codeclimate.com/github/socketry/async-rspec)
|
9
|
-
[![Coverage Status](https://coveralls.io/repos/socketry/async-rspec/badge.svg)](https://coveralls.io/r/socketry/async-rspec)
|
10
|
-
|
11
|
-
## Installation
|
12
|
-
|
13
|
-
Add this line to your application's Gemfile:
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
gem 'async-rspec'
|
17
|
-
```
|
18
|
-
|
19
|
-
And then execute:
|
20
|
-
|
21
|
-
$ bundle
|
22
|
-
|
23
|
-
Or install it yourself as:
|
24
|
-
|
25
|
-
$ gem install async-rspec
|
26
|
-
|
27
|
-
Finally, add this require statement to the top of `spec/spec_helper.rb`
|
28
|
-
|
29
|
-
```ruby
|
30
|
-
require 'async/rspec'
|
31
|
-
```
|
32
|
-
|
33
|
-
## Usage
|
34
|
-
|
35
|
-
### Async Reactor
|
36
|
-
|
37
|
-
Many specs need to run within a reactor. A shared context is provided which includes all the relevant bits, including the above leaks checks. If your spec fails to run in less than 10 seconds, an `Async::TimeoutError` raises to prevent your test suite from hanging.
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
require 'async/io'
|
41
|
-
|
42
|
-
RSpec.describe Async::IO do
|
43
|
-
include_context Async::RSpec::Reactor
|
44
|
-
|
45
|
-
let(:pipe) {IO.pipe}
|
46
|
-
let(:input) {Async::IO::Generic.new(pipe.first)}
|
47
|
-
let(:output) {Async::IO::Generic.new(pipe.last)}
|
48
|
-
|
49
|
-
it "should send and receive data within the same reactor" do
|
50
|
-
message = nil
|
51
|
-
|
52
|
-
output_task = reactor.async do
|
53
|
-
message = input.read(1024)
|
54
|
-
end
|
55
|
-
|
56
|
-
reactor.async do
|
57
|
-
output.write("Hello World")
|
58
|
-
end
|
59
|
-
|
60
|
-
output_task.wait
|
61
|
-
expect(message).to be == "Hello World"
|
62
|
-
|
63
|
-
input.close
|
64
|
-
output.close
|
65
|
-
end
|
66
|
-
end
|
67
|
-
```
|
68
|
-
|
69
|
-
### Changing Timeout
|
70
|
-
|
71
|
-
You can change the timeout by specifying it as an option:
|
72
|
-
|
73
|
-
```ruby
|
74
|
-
RSpec.describe MySlowThing, timeout: 60 do
|
75
|
-
# ...
|
76
|
-
end
|
77
|
-
```
|
78
|
-
|
79
|
-
### File Descriptor Leaks
|
80
|
-
|
81
|
-
Leaking sockets and other kinds of IOs are a problem for long running services. `Async::RSpec::Leaks` tracks all open sockets both before and after the spec. If any are left open, a `RuntimeError` is raised and the spec fails.
|
82
|
-
|
83
|
-
```ruby
|
84
|
-
RSpec.describe "leaky ios" do
|
85
|
-
include_context Async::RSpec::Leaks
|
86
|
-
|
87
|
-
# The following fails:
|
88
|
-
it "leaks io" do
|
89
|
-
@input, @output = IO.pipe
|
90
|
-
end
|
91
|
-
end
|
92
|
-
```
|
93
|
-
|
94
|
-
In some cases, the Ruby garbage collector will close IOs. In the above case, it's possible that just writing `IO.pipe` will not leak as Ruby will garbage collect the resulting IOs immediately. It's still incorrect to not close IOs, so don't depend on this behaviour.
|
95
|
-
|
96
|
-
### Allocations
|
97
|
-
|
98
|
-
This functionality was moved to [`rspec-memory`](https://github.com/socketry/rspec-memory).
|
99
|
-
|
100
|
-
## Contributing
|
101
|
-
|
102
|
-
1. Fork it
|
103
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
104
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
105
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
106
|
-
5. Create new Pull Request
|
107
|
-
|
108
|
-
## License
|
109
|
-
|
110
|
-
Released under the MIT license.
|
111
|
-
|
112
|
-
Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
113
|
-
|
114
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
115
|
-
of this software and associated documentation files (the "Software"), to deal
|
116
|
-
in the Software without restriction, including without limitation the rights
|
117
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
118
|
-
copies of the Software, and to permit persons to whom the Software is
|
119
|
-
furnished to do so, subject to the following conditions:
|
120
|
-
|
121
|
-
The above copyright notice and this permission notice shall be included in
|
122
|
-
all copies or substantial portions of the Software.
|
123
|
-
|
124
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
125
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
126
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
127
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
128
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
129
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
130
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
data/async-rspec.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
require_relative 'lib/async/rspec/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "async-rspec"
|
6
|
-
spec.version = Async::RSpec::VERSION
|
7
|
-
spec.authors = ["Samuel Williams"]
|
8
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
-
|
10
|
-
spec.summary = "Helpers for writing specs against the async gem."
|
11
|
-
spec.homepage = "https://github.com/socketry/async-rspec"
|
12
|
-
|
13
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
14
|
-
f.match(%r{^(test|spec|features)/})
|
15
|
-
end
|
16
|
-
|
17
|
-
spec.require_paths = ["lib"]
|
18
|
-
|
19
|
-
spec.add_dependency "rspec", "~> 3.0"
|
20
|
-
spec.add_dependency "rspec-memory", "~> 1.0"
|
21
|
-
spec.add_dependency "rspec-files", "~> 1.0"
|
22
|
-
|
23
|
-
# Since we test the shared contexts, we need some bits of async:
|
24
|
-
spec.add_development_dependency "async", "~> 1.24"
|
25
|
-
|
26
|
-
spec.add_development_dependency "covered"
|
27
|
-
spec.add_development_dependency "bundler"
|
28
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
-
end
|