async-rspec 1.12.0 → 1.12.1

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: 6c2d95df4c4ef00551c2f02d394699521e480a1611515e3b4874546ce73b8629
4
- data.tar.gz: 4d4d58a918c1a2624b80c110db6870fde12edb1312f3d68de155e7c87b4128e0
3
+ metadata.gz: f433e1d62ca61d5912dbd87faa8b040bd0ae84f178f53da363c95b2e78ddab42
4
+ data.tar.gz: ae690667bbcdf40bab65fdf7555b1e066de9a3e38770e0e5aeec6c3659b34710
5
5
  SHA512:
6
- metadata.gz: 30d8f60df695eec4e6d859f71f401e92efb16290cbc8f4a856c1a209c933c61c16b99c56fe69fad3af1beda1b6feb31e8a09b6725af70affc633c24a0607397f
7
- data.tar.gz: 177319bfb83afdf5e407dfc4397bbc11d0118cc0bb2f04576b7868d83aaf90c0453c728eaaa5b64150d560bb8df474fab89a74bcb8c624addc12980cd7ba9499
6
+ metadata.gz: f43505247ce2d331e5683c409c6cae1db98fd8b566471c3963dd65e11975126c100a1167689718efe81999c33b7c386dc3b78c2c0fdc47feeb9798eb49ef8e67
7
+ data.tar.gz: aca076025b7cedb20339bb2327caa648eca21915c6e6f7740880fb06131462efeb022cb8463f58305614d15e19325491e8cb58cd1e937c95eec6bea99046550e
@@ -0,0 +1,6 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = tab
5
+ indent_size = 2
6
+
@@ -1,23 +1,19 @@
1
1
  language: ruby
2
- sudo: false
3
- dist: trusty
4
2
  cache: bundler
5
3
 
6
- before_script:
7
- - gem update --system
8
- - gem install bundler
9
-
10
4
  matrix:
11
5
  include:
12
6
  - rvm: 2.3
13
7
  - rvm: 2.4
14
8
  - rvm: 2.5
15
9
  - rvm: 2.6
10
+ - rvm: 2.6
11
+ env: COVERAGE=BriefSummary,Coveralls
12
+ - rvm: ruby-head
16
13
  - rvm: jruby-head
17
14
  env: JRUBY_OPTS="--debug -X+O"
18
- - rvm: ruby-head
19
- - rvm: rbx-3
15
+ - rvm: truffleruby
20
16
  allow_failures:
21
17
  - rvm: ruby-head
22
18
  - rvm: jruby-head
23
- - rvm: rbx-3
19
+ - rvm: truffleruby
data/README.md CHANGED
@@ -23,12 +23,18 @@ And then execute:
23
23
  Or install it yourself as:
24
24
 
25
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
+ ```
26
32
 
27
33
  ## Usage
28
34
 
29
35
  ### Leaks
30
36
 
31
- Leaking sockets and other kinds of IOs is a problem for long running services. `Async::RSpec::Leaks` tracks all open sockets both before and after the spec. If any are left open, the spec fails.
37
+ 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.
32
38
 
33
39
  ```ruby
34
40
  RSpec.describe "leaky ios" do
@@ -41,7 +47,7 @@ RSpec.describe "leaky ios" do
41
47
  end
42
48
  ```
43
49
 
44
- In some cases, the Ruby garbage collector will close IOs. In the above case, it's possible to just writing `IO.pipe` will not leak, as Ruby will garbage collect the resulting IOs immediately. It's still incorrect to not correctly close IOs, so don't depend on this behaviour.
50
+ 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.
45
51
 
46
52
  ### Allocations
47
53
 
@@ -60,42 +66,47 @@ RSpec.describe "memory allocations" do
60
66
  it "limits allocation counts (hash)" do
61
67
  expect do
62
68
  6.times{String.new}
63
- end.to limit_allocations(String => { count: 10 }) # 10 strings can be allocated
69
+ end.to limit_allocations(String => {count: 10}) # 10 strings can be allocated
64
70
  end
65
71
 
66
72
  it "limits allocation size" do
67
73
  expect do
68
74
  6.times{String.new("foo")}
69
- end.to limit_allocations(String => { size: 1024 }) # 1 KB of strings can be allocated
75
+ end.to limit_allocations(String => {size: 1024}) # 1 KB of strings can be allocated
70
76
  end
71
77
  end
72
78
  ```
73
79
 
74
80
  ### Reactor
75
81
 
76
- Many specs need to run within a reactor. A shared context is provided which includes all the relevant bits, including the above leaks checks.
82
+ 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.
77
83
 
78
84
  ```ruby
79
- RSpec.describe IO do
85
+ require 'async/io'
86
+
87
+ RSpec.describe Async::IO do
80
88
  include_context Async::RSpec::Reactor
81
89
 
82
90
  let(:pipe) {IO.pipe}
83
- let(:input) {pipe.last}
84
- let(:output) {pipe.first}
91
+ let(:input) {Async::IO::Generic.new(pipe.first)}
92
+ let(:output) {Async::IO::Generic.new(pipe.last)}
85
93
 
86
94
  it "should send and receive data within the same reactor" do
87
95
  message = nil
88
96
 
89
- output_task = reactor.with(output) do |wrapper|
90
- message = wrapper.read(1024)
97
+ output_task = reactor.async do
98
+ message = input.read(1024)
91
99
  end
92
100
 
93
- reactor.with(input) do |wrapper|
94
- wrapper.write("Hello World")
101
+ reactor.async do
102
+ output.write("Hello World")
95
103
  end
96
104
 
97
105
  output_task.wait
98
106
  expect(message).to be == "Hello World"
107
+
108
+ input.close
109
+ output.close
99
110
  end
100
111
  end
101
112
  ```
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  # Since we test the shared contexts, we need some bits of async:
22
22
  spec.add_development_dependency "async", "~> 1.8"
23
23
 
24
+ spec.add_development_dependency "covered"
24
25
  spec.add_development_dependency "bundler", "~> 1.13"
25
26
  spec.add_development_dependency "rake", "~> 10.0"
26
27
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module RSpec
23
- VERSION = "1.12.0"
23
+ VERSION = "1.12.1"
24
24
  end
25
25
  end
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.12.0
4
+ version: 1.12.1
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-06 00:00:00.000000000 Z
11
+ date: 2019-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: covered
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -73,6 +87,7 @@ executables: []
73
87
  extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
90
+ - ".editorconfig"
76
91
  - ".gitignore"
77
92
  - ".rspec"
78
93
  - ".travis.yml"
@@ -108,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
123
  - !ruby/object:Gem::Version
109
124
  version: '0'
110
125
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 2.7.7
126
+ rubygems_version: 3.0.2
113
127
  signing_key:
114
128
  specification_version: 4
115
129
  summary: Helpers for writing specs against the async gem.