async-rspec 1.0.0 → 1.1.0

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
  SHA1:
3
- metadata.gz: 21ff7c7c6a222fbb08087d2d729eb33979714ad3
4
- data.tar.gz: 99f561cf8cf6d404b99ba916537ff0ce4366480f
3
+ metadata.gz: 71491846f3d0cc9a03b883ddb403ba7d263a8dc5
4
+ data.tar.gz: e5dec9b2763165b4420102148272f5c6aedd0985
5
5
  SHA512:
6
- metadata.gz: bf604d927e96025042bd201b85546b2e9edcde88edd74e35647e1b8a473244ef4c0b8ecc1a96be327fa02beee2c9cceb9c4068c58c2188266204375126a1df6e
7
- data.tar.gz: 8784bcc4a207eb18fb1667114cae61d69387878bf35e214aa95f8174eafeabd67c16906c5ceb493684ec38a96db2c7565f779b734bd7af16c8e57002f3fb03d6
6
+ metadata.gz: 3b0287ca7aa17d1f27701dd08c4a31647a9dbbb06123fa8f85e76986bd7eb4f948277407fd0394ec462e080c550338d76f3b3fa2c8c8d75a7dd4d8a02b53143c
7
+ data.tar.gz: f25107c8161a2ad8e7d74eeb558df43b98e1b268f03b2052681ea8647e48e85ecccd8ff7572d1e8227a62dc73ab352a3a9a2e1b5deb3538a84ff042c345e0e5a
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  # Since we test the shared contexts, we need some bits of async:
22
22
  spec.add_development_dependency "async"
23
+ spec.add_development_dependency "ruby-prof"
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.13"
25
26
  spec.add_development_dependency "rake", "~> 10.0"
@@ -22,7 +22,7 @@ module Async
22
22
  module RSpec
23
23
  module Leaks
24
24
  def current_ios(gc: GC.start)
25
- all_ios = ObjectSpace.each_object(IO).to_a.sort_by(&:object_id)
25
+ all_ios = ObjectSpace.each_object(::IO).to_a.sort_by(&:object_id)
26
26
 
27
27
  # We are not interested in ios that have been closed already:
28
28
  return all_ios.reject{|io| io.closed?}
@@ -0,0 +1,49 @@
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.
20
+
21
+ module Async
22
+ module RSpec
23
+ module Profile
24
+ end
25
+
26
+ begin
27
+ require 'ruby-prof'
28
+
29
+ RSpec.shared_context Profile do
30
+ let(:profile) {RubyProf::Profile.new(merge_fibers: true)}
31
+
32
+ after(:each) do |example|
33
+ unless profile.threads.empty?
34
+ # profile.eliminate_methods!([/RSpec::/])
35
+
36
+ printer = RubyProf::FlatPrinter.new(profile)
37
+ printer.print(STDOUT)
38
+ end
39
+ end
40
+ end
41
+ rescue LoadError
42
+ RSpec.shared_context Profile do
43
+ before(:all) do
44
+ puts "Profiling not enabled/supported."
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module RSpec
23
- VERSION = "1.0.0"
23
+ VERSION = "1.1.0"
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.0.0
4
+ version: 1.1.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: 2017-05-22 00:00:00.000000000 Z
11
+ date: 2017-06-06 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: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ruby-prof
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
@@ -82,6 +96,7 @@ files:
82
96
  - async-rspec.gemspec
83
97
  - lib/async/rspec.rb
84
98
  - lib/async/rspec/leaks.rb
99
+ - lib/async/rspec/profile.rb
85
100
  - lib/async/rspec/reactor.rb
86
101
  - lib/async/rspec/version.rb
87
102
  homepage: https://github.com/socketry/async-rspec