rspec-memory 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1d7b4e2fc50cd98f2e40bb5cb19f63c3972533912afa460d7391089f3241087
4
- data.tar.gz: 2efe634f53910265f7f3ba43e76ec705455ef89e29a99d337e239de4231389bd
3
+ metadata.gz: '09148799fe58142e9b7a6f9815c3b2ad981b088b9cf0d8ce98a21efd28ba3e13'
4
+ data.tar.gz: 5ddfe03948374f2af0f74b9cdd366602246958bf7951b269f01ee72bee2512f2
5
5
  SHA512:
6
- metadata.gz: 26198b9cce4b0cac807b26f5b23bd2f85b6cc85da77e6b5b7bd06028531c8d9f90fa1d6f429467b42761e603e8081b7928f7697c7f11c48d2f1d8efe34360945
7
- data.tar.gz: 14bea85597166f34189f33450550d1ce3f2da0bb50d40efbc31c6c2afa1e6c53f4120eeb6e298add62e7e2543073aad40456a7c27a0c049dd0888cd5e8bfd538
6
+ metadata.gz: 1ea765de44619b4b8b25bf3386ddd2f2591c513472b363208207cb95023007cfb5320583a280adc670f28b82662ee58ad52789d67fb17586cdfb42319dd82b2d
7
+ data.tar.gz: ef248941859fa32eddcc5acf4af5816e36481268fce8ff4ee42259933c813271de5f633e93a2ee72e3298cbfa3bf988f0d025412dbc69436d0a478c2522d9505
@@ -23,7 +23,7 @@ require 'objspace'
23
23
  module RSpec
24
24
  module Memory
25
25
  Allocation = Struct.new(:count, :size) do
26
- SLOT_SIZE = 40
26
+ SLOT_SIZE = ObjectSpace.memsize_of(Object.new)
27
27
 
28
28
  def << object
29
29
  self.count += 1
@@ -20,6 +20,6 @@
20
20
 
21
21
  module RSpec
22
22
  module Memory
23
- VERSION = "1.0.2"
23
+ VERSION = "1.0.3"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-memory
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
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: 2020-03-05 00:00:00.000000000 Z
11
+ date: 2021-12-10 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: covered
28
+ name: bundler
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: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: covered
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -66,30 +66,21 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.0'
69
- description:
69
+ description:
70
70
  email:
71
- - samuel.williams@oriontransfer.co.nz
72
71
  executables: []
73
72
  extensions: []
74
73
  extra_rdoc_files: []
75
74
  files:
76
- - ".editorconfig"
77
- - ".gitignore"
78
- - ".rspec"
79
- - ".travis.yml"
80
- - Gemfile
81
- - README.md
82
- - Rakefile
83
75
  - lib/rspec/memory.rb
84
76
  - lib/rspec/memory/matchers/limit_allocations.rb
85
77
  - lib/rspec/memory/trace.rb
86
78
  - lib/rspec/memory/version.rb
87
- - rspec-memory.gemspec
88
79
  homepage: https://github.com/socketry/rspec-memory
89
80
  licenses:
90
81
  - MIT
91
82
  metadata: {}
92
- post_install_message:
83
+ post_install_message:
93
84
  rdoc_options: []
94
85
  require_paths:
95
86
  - lib
@@ -104,8 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
95
  - !ruby/object:Gem::Version
105
96
  version: '0'
106
97
  requirements: []
107
- rubygems_version: 3.1.2
108
- signing_key:
98
+ rubygems_version: 3.2.32
99
+ signing_key:
109
100
  specification_version: 4
110
101
  summary: RSpec helpers for checking memory allocations.
111
102
  test_files: []
data/.editorconfig DELETED
@@ -1,6 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = tab
5
- indent_size = 2
6
-
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
13
- .covered.db
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --warnings
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,22 +0,0 @@
1
- language: ruby
2
- dist: xenial
3
- cache: bundler
4
-
5
- matrix:
6
- include:
7
- - rvm: 2.3
8
- - rvm: 2.4
9
- - rvm: 2.5
10
- - rvm: 2.6
11
- - rvm: 2.7
12
- - rvm: 2.6
13
- env: COVERAGE=BriefSummary,Coveralls
14
- - rvm: 2.7
15
- - rvm: ruby-head
16
- - rvm: jruby-head
17
- env: JRUBY_OPTS="--debug -X+O"
18
- - rvm: truffleruby
19
- allow_failures:
20
- - rvm: ruby-head
21
- - rvm: jruby-head
22
- - rvm: truffleruby
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in rspec-memory.gemspec
4
- gemspec
data/README.md DELETED
@@ -1,87 +0,0 @@
1
- # RSpec::Memory
2
-
3
- Make assertions about memory usage.
4
-
5
- [![Build Status](https://travis-ci.com/socketry/rspec-memory.svg?branch=master)](https://travis-ci.com/socketry/rspec-memory)
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'rspec-memory'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install rspec-memory
22
-
23
- Finally, add this require statement to the top of `spec/spec_helper.rb`
24
-
25
- ```ruby
26
- require 'rspec/memory'
27
- ```
28
-
29
- ## Usage
30
-
31
- Allocating large amounts of objects can lead to memory problems. `RSpec::Memory` adds a `limit_allocations` matcher, which tracks the number of allocations and memory size for each object type and allows you to specify expected limits.
32
-
33
- ```ruby
34
- RSpec.describe "memory allocations" do
35
- include_context RSpec::Memory
36
-
37
- it "limits allocation counts" do
38
- expect do
39
- 6.times{String.new}
40
- end.to limit_allocations(String => 10) # 10 strings can be allocated
41
- end
42
-
43
- it "limits allocation counts (hash)" do
44
- expect do
45
- 6.times{String.new}
46
- end.to limit_allocations(String => {count: 10}) # 10 strings can be allocated
47
- end
48
-
49
- it "limits allocation size" do
50
- expect do
51
- 6.times{String.new("foo")}
52
- end.to limit_allocations(String => {size: 1024}) # 1 KB of strings can be allocated
53
- end
54
- end
55
- ```
56
-
57
- ## Contributing
58
-
59
- 1. Fork it
60
- 2. Create your feature branch (`git checkout -b my-new-feature`)
61
- 3. Commit your changes (`git commit -am 'Add some feature'`)
62
- 4. Push to the branch (`git push origin my-new-feature`)
63
- 5. Create new Pull Request
64
-
65
- ## License
66
-
67
- Released under the MIT license.
68
-
69
- Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
70
-
71
- Permission is hereby granted, free of charge, to any person obtaining a copy
72
- of this software and associated documentation files (the "Software"), to deal
73
- in the Software without restriction, including without limitation the rights
74
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
75
- copies of the Software, and to permit persons to whom the Software is
76
- furnished to do so, subject to the following conditions:
77
-
78
- The above copyright notice and this permission notice shall be included in
79
- all copies or substantial portions of the Software.
80
-
81
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
82
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
83
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
84
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
85
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
86
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
87
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:test)
5
-
6
- task :default => :test
data/rspec-memory.gemspec DELETED
@@ -1,25 +0,0 @@
1
- # coding: utf-8
2
- require_relative 'lib/rspec/memory/version'
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "rspec-memory"
6
- spec.version = RSpec::Memory::VERSION
7
- spec.licenses = ["MIT"]
8
- spec.authors = ["Samuel Williams"]
9
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
10
-
11
- spec.summary = "RSpec helpers for checking memory allocations."
12
- spec.homepage = "https://github.com/socketry/rspec-memory"
13
-
14
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
15
- f.match(%r{^(test|spec|features)/})
16
- end
17
-
18
- spec.require_paths = ["lib"]
19
-
20
- spec.add_dependency "rspec", "~> 3.0"
21
-
22
- spec.add_development_dependency "covered"
23
- spec.add_development_dependency "bundler"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- end