spec/spec_helper.rb in async-dns-0.12.0 vs spec/spec_helper.rb in async-dns-1.0.0

- old
+ new

@@ -24,10 +24,29 @@ require "bundler/setup" require "async/rspec" require "async/dns" -# abort "Warning, ulimit is too low!" if `ulimit -n`.to_i < 10000 +begin + require 'ruby-prof' + + RSpec.shared_context "profile" do + around(:each) do |example| + profile = RubyProf.profile(merge_fibers: true) do + example.run + end + + printer = RubyProf::FlatPrinter.new(profile) + printer.print(STDOUT) + end + end +rescue LoadError + RSpec.shared_context "profile" do + before(:all) do + puts "Profiling not supported on this platform." + end + end +end RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status"