async-rspec 1.2.0 → 1.3.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/leaks.rb +1 -3
- data/lib/async/rspec/reactor.rb +17 -16
- data/lib/async/rspec/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cb1fb4f59a7f05ba63b18e9f2b44b07364b711422fe1870d556a4a57e6e53f9
|
4
|
+
data.tar.gz: a487cd7d0f93e0dd6dba63d2c7d53e741ab7b6db26c799586eaee886137bbfc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8247782ea3f2dc73d5bd72df2a35d917240c8a5fe9c5f12785297c56f4c46ffd4be8e7be7d2637fdf31ffd3c05492b8df1b31f5e9695ccfcc1a4165d4af2ef67
|
7
|
+
data.tar.gz: 3868142cdde06ebc353e1673702e3a33e7a2be9aafe96106f13f9601f63433b9dc71a364755503d656a0e5d00cccd93dca56c6d8384313dc0943b714cf3f428f
|
data/lib/async/rspec/leaks.rb
CHANGED
@@ -32,13 +32,11 @@ module Async
|
|
32
32
|
RSpec.shared_context Leaks do
|
33
33
|
include Leaks
|
34
34
|
|
35
|
-
let(:before_ios) {current_ios}
|
35
|
+
let!(:before_ios) {current_ios}
|
36
36
|
let(:after_ios) {current_ios}
|
37
37
|
|
38
38
|
# We use around(:each) because it's the highest priority.
|
39
39
|
around(:each) do |example|
|
40
|
-
before_ios
|
41
|
-
|
42
40
|
example.run.tap do
|
43
41
|
expect(after_ios).to be == before_ios
|
44
42
|
end
|
data/lib/async/rspec/reactor.rb
CHANGED
@@ -23,31 +23,32 @@ require 'async/reactor'
|
|
23
23
|
|
24
24
|
module Async
|
25
25
|
module RSpec
|
26
|
-
|
27
|
-
def
|
28
|
-
all_ios = ObjectSpace.each_object(IO).to_a.sort_by(&:object_id)
|
29
|
-
|
30
|
-
# We are not interested in ios that have been closed already:
|
31
|
-
return all_ios.reject{|io| io.closed?}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
RSpec.shared_context Reactor do
|
36
|
-
let(:reactor) {Async::Task.current.reactor}
|
37
|
-
|
38
|
-
include_context Async::RSpec::Leaks
|
39
|
-
|
40
|
-
def run_reactor(example)
|
26
|
+
module Reactor
|
27
|
+
def run_reactor(example, duration = nil)
|
41
28
|
result = nil
|
42
29
|
|
30
|
+
duration ||= example.metadata[:timeout] || 60
|
31
|
+
|
43
32
|
Async::Reactor.run do |task|
|
44
|
-
|
33
|
+
task.timeout(duration) do
|
34
|
+
result = example.run
|
35
|
+
|
36
|
+
task.children.each(&:wait)
|
37
|
+
end
|
45
38
|
|
46
39
|
task.reactor.stop if result.is_a? Exception
|
47
40
|
end
|
48
41
|
|
49
42
|
return result
|
50
43
|
end
|
44
|
+
end
|
45
|
+
|
46
|
+
RSpec.shared_context Reactor do
|
47
|
+
include Reactor
|
48
|
+
|
49
|
+
let(:reactor) {Async::Task.current.reactor}
|
50
|
+
|
51
|
+
include_context Async::RSpec::Leaks
|
51
52
|
|
52
53
|
around(:each) do |example|
|
53
54
|
run_reactor(example)
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.7.
|
122
|
+
rubygems_version: 2.7.6
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Helpers for writing specs against the async gem.
|