Skip to content

Instantly share code, notes, and snippets.

@uday-rayala
Created December 14, 2015 09:47
Show Gist options
  • Save uday-rayala/2ed67c405c7e0a21aebf to your computer and use it in GitHub Desktop.
Save uday-rayala/2ed67c405c7e0a21aebf to your computer and use it in GitHub Desktop.
RSpec.configure do |c|
# Enable profiling on the spec
c.before(:all) do |x|
RubyProf.start
end
c.after(:all) do |x|
results = RubyProf.stop
results.eliminate_methods!([/RSpec::Core/])
artifacts_dir = "artifacts/performance/"
FileUtils.mkdir_p(artifacts_dir)
File.open "#{artifacts_dir}/#{self.class.metadata[:full_description]}.html", 'w' do |file|
RubyProf::GraphHtmlPrinter.new(results).print(file)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment