async-rspec 1.9.0 → 1.10.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/buffer.rb +49 -0
- data/lib/async/rspec/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd4fc058feafaaee85e9acf0f0a2ec2c3ab92bd92e4ac73e3f46d14b03d97578
|
4
|
+
data.tar.gz: c1805c3241d533c7f1a3013f1d84b32af9906b68f1a9ea2473f512069af40afc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c66d571d6735d91a5580764046cf48cc4ec14f20b3b57737c5fcfcf6e1816234ae8549f503b5e567dbd2973a87cd2912823834054b47e7083adad79af296f05
|
7
|
+
data.tar.gz: 8ee06a9db6ebb397ace13829979c6ee45593e2ff1be5b968d7be0b061f6b287d6c56e6cc2df7422aaee7ce6c316d5783683d9df44605d6e919ebe8b922c28b2a
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Copyright, 2018, 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.
|
20
|
+
|
21
|
+
require 'securerandom'
|
22
|
+
|
23
|
+
module Async
|
24
|
+
module RSpec
|
25
|
+
module Buffer
|
26
|
+
TMP = "/tmp"
|
27
|
+
|
28
|
+
def self.open(mode = 'w+', root: TMP)
|
29
|
+
path = File.join(root, SecureRandom.hex(32))
|
30
|
+
file = File.open(path, mode)
|
31
|
+
|
32
|
+
File.unlink(path)
|
33
|
+
|
34
|
+
return file unless block_given?
|
35
|
+
|
36
|
+
begin
|
37
|
+
yield file
|
38
|
+
ensure
|
39
|
+
file.close
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
RSpec.shared_context Buffer do
|
45
|
+
let(:buffer) {Buffer.open}
|
46
|
+
after(:each) {buffer.close}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/async/rspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- Rakefile
|
82
82
|
- async-rspec.gemspec
|
83
83
|
- lib/async/rspec.rb
|
84
|
+
- lib/async/rspec/buffer.rb
|
84
85
|
- lib/async/rspec/leaks.rb
|
85
86
|
- lib/async/rspec/memory.rb
|
86
87
|
- lib/async/rspec/memory/limit_allocations.rb
|