lib/async/rspec/profile.rb in async-rspec-1.5.0 vs lib/async/rspec/profile.rb in async-rspec-1.6.0
- old
+ new
@@ -25,24 +25,28 @@
begin
require 'ruby-prof'
RSpec.shared_context Profile do
- let(:profile) {RubyProf::Profile.new(merge_fibers: true)}
-
- after(:each) do |example|
- unless profile.threads.empty?
- # profile.eliminate_methods!([/RSpec::/])
+ around(:each) do |example|
+ profile = RubyProf::Profile.new(merge_fibers: true)
+
+ begin
+ profile.start
+ example.run
+ ensure
+ profile.stop
+
printer = RubyProf::FlatPrinter.new(profile)
printer.print(STDOUT)
end
end
end
rescue LoadError
RSpec.shared_context Profile do
before(:all) do
- puts "Profiling not enabled/supported."
+ warn "Profiling not enabled/supported."
end
end
end
end
end