rspec-files 1.1.2 → 1.1.3

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: 8189a3a251f6d5826050d37894fc5f0b7e4fa2bd11a268f47202452d028d3d68
4
- data.tar.gz: d7e38ba998be441f151a652bea0a3b3c8d19ce2e8a6cbc104b2545cc0f8617df
3
+ metadata.gz: 0f635daa958c6a3590355a1ca86ddfbc96649aff16a38a842684f3f64f93c2f8
4
+ data.tar.gz: 1b7772a0018fe95401fe954788ca6bb3b2f671b56b339eec1ef351d31ebe9f12
5
5
  SHA512:
6
- metadata.gz: 1683a7b03a2ac426df45a54dc390615d4a3925b86ac2aa7e41456f345d2e19dbf5a69bda1d486a23cccf6f9cf85aece71fc9d3b6a3ae61d79dc72b7ee3235245
7
- data.tar.gz: 3b679dfc4500a0d0249aeee86dde489163487430ec708489cfc0b77646cd1cc22ac31ae28d39f56553dc4271bca1451a6b8a62999a9d10b78552c2bddffd1f48
6
+ metadata.gz: 2eaab6674fe723708b233194d4031e204d696965ef2f3ca069969a06c2d88229d52aae2541dde87aecad4888354ae80a906085d4cbac05b591fa081306978f66
7
+ data.tar.gz: f65c5d22e6bc49e0ea7b9ebe5e81b943d525f82a1abe5c213b208aecd169e3abb0eb3bf662b0a37152525b8df1c2b693e7d9aa4ecb73ffbc6122256d300564e5
checksums.yaml.gz.sig ADDED
Binary file
@@ -1,22 +1,7 @@
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.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2019, by Samuel Williams.
20
5
 
21
6
  require 'securerandom'
22
7
 
@@ -1,22 +1,8 @@
1
- # Copyright, 2017, 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
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2019-2022, by Samuel Williams.
5
+ # Copyright, 2020, by Scott Tadman.
20
6
 
21
7
  module RSpec
22
8
  module Files
@@ -27,7 +13,10 @@ module RSpec
27
13
  all_ios = ObjectSpace.each_object(::IO).to_a.sort_by(&:object_id)
28
14
 
29
15
  # We are not interested in ios that have been closed already:
30
- return all_ios.reject(&:closed?)
16
+ return all_ios.reject do |io|
17
+ # It's possible to get errors if the IO is finalised.
18
+ io.closed? rescue true
19
+ end
31
20
  rescue RuntimeError => error
32
21
  # This occurs on JRuby.
33
22
  warn error.message
@@ -1,25 +1,10 @@
1
- # Copyright, 2017, 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
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2019-2022, by Samuel Williams.
20
5
 
21
6
  module RSpec
22
7
  module Files
23
- VERSION = "1.1.2"
8
+ VERSION = "1.1.3"
24
9
  end
25
10
  end
data/lib/rspec/files.rb CHANGED
@@ -1,22 +1,8 @@
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
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2019, by Samuel Williams.
5
+ # Copyright, 2022, by Gleb Sinyavskiy.
20
6
 
21
7
  require 'rspec/core'
22
8
 
data/license.md ADDED
@@ -0,0 +1,25 @@
1
+ # MIT License
2
+
3
+ Copyright, 2019-2022, by Samuel Williams.
4
+ Copyright, 2019, by Cyril Roelandt.
5
+ Copyright, 2020, by Olle Jonsson.
6
+ Copyright, 2020, by Scott Tadman.
7
+ Copyright, 2022, by Gleb Sinyavskiy.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
data/readme.md ADDED
@@ -0,0 +1,71 @@
1
+ # RSpec::Files
2
+
3
+ Detect leaked file descriptors and provides convenient file buffers.
4
+
5
+ [![Development Status](https://github.com/socketry/rspec-files/workflows/Test/badge.svg)](https://github.com/socketry/rspec-files/actions?workflow=Test)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ``` ruby
12
+ gem 'rspec-files'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rspec-files
22
+
23
+ Finally, add this require statement to the top of `spec/spec_helper.rb`
24
+
25
+ ``` ruby
26
+ require 'rspec/files'
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### Leaks
32
+
33
+ Leaking sockets and other kinds of IOs are a problem for long running services. `RSpec::Files::Leaks` tracks all open sockets both before and after the spec. If any are left open, a `RuntimeError` is raised and the spec fails.
34
+
35
+ ``` ruby
36
+ RSpec.describe "leaky ios" do
37
+ include_context RSpec::Files::Leaks
38
+
39
+ # The following fails:
40
+ it "leaks io" do
41
+ @input, @output = IO.pipe
42
+ end
43
+ end
44
+ ```
45
+
46
+ 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.
47
+
48
+ ### Buffers
49
+
50
+ File buffers are useful for specs which implement I/O operations. This context automatically manages a disk-based file which can be used for buffering.
51
+
52
+ ``` ruby
53
+ RSpec.describe "buffer" do
54
+ include_context RSpec::Files::Buffer
55
+
56
+ it "can read and write data" do
57
+ buffer.write("Hello World")
58
+ buffer.seek(0)
59
+
60
+ expect(buffer.read).to be == "Hello World"
61
+ end
62
+ end
63
+ ```
64
+
65
+ ## Contributing
66
+
67
+ 1. Fork it
68
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
69
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
70
+ 4. Push to the branch (`git push origin my-new-feature`)
71
+ 5. Create new Pull Request
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-files
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -11,8 +11,37 @@ authors:
11
11
  - Olle Jonsson
12
12
  autorequire:
13
13
  bindir: bin
14
- cert_chain: []
15
- date: 2022-06-03 00:00:00.000000000 Z
14
+ cert_chain:
15
+ - |
16
+ -----BEGIN CERTIFICATE-----
17
+ MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
18
+ ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
19
+ CZImiZPyLGQBGRYCY28xEjAQB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UAA4IBgQB5sxkE
35
+ cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
36
+ xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
37
+ c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
38
+ 8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
39
+ JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
40
+ eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
41
+ Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
42
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
43
+ -----END CERTIFICATE-----
44
+ date: 2022-10-13 00:00:00.000000000 Z
16
45
  dependencies:
17
46
  - !ruby/object:Gem::Dependency
18
47
  name: rspec
@@ -66,6 +95,8 @@ files:
66
95
  - lib/rspec/files/buffer.rb
67
96
  - lib/rspec/files/leaks.rb
68
97
  - lib/rspec/files/version.rb
98
+ - license.md
99
+ - readme.md
69
100
  homepage: https://github.com/socketry/rspec-files
70
101
  licenses:
71
102
  - MIT
@@ -85,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
116
  - !ruby/object:Gem::Version
86
117
  version: '0'
87
118
  requirements: []
88
- rubygems_version: 3.3.8
119
+ rubygems_version: 3.3.7
89
120
  signing_key:
90
121
  specification_version: 4
91
122
  summary: RSpec helpers for buffering and detecting file descriptor leaks.
metadata.gz.sig ADDED
Binary file