Install and configure rubyprof
This commit is contained in:
parent
954b62e06e
commit
99b6500e5f
1
Gemfile
1
Gemfile
|
|
@ -47,6 +47,7 @@ group :test, optional: true do
|
||||||
gem 'faker'
|
gem 'faker'
|
||||||
gem 'rspec-rails'
|
gem 'rspec-rails'
|
||||||
gem 'shoulda-matchers'
|
gem 'shoulda-matchers'
|
||||||
|
gem 'ruby-prof'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, optional: true do
|
group :development, optional: true do
|
||||||
|
|
|
||||||
|
|
@ -267,6 +267,7 @@ GEM
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 1.33.0, < 2.0)
|
rubocop (>= 1.33.0, < 2.0)
|
||||||
rubocop-ast (>= 1.31.1, < 2.0)
|
rubocop-ast (>= 1.31.1, < 2.0)
|
||||||
|
ruby-prof (1.7.1)
|
||||||
ruby-progressbar (1.13.0)
|
ruby-progressbar (1.13.0)
|
||||||
shoulda-matchers (6.2.0)
|
shoulda-matchers (6.2.0)
|
||||||
activesupport (>= 5.2.0)
|
activesupport (>= 5.2.0)
|
||||||
|
|
@ -334,6 +335,7 @@ DEPENDENCIES
|
||||||
rubocop
|
rubocop
|
||||||
rubocop-performance
|
rubocop-performance
|
||||||
rubocop-rails
|
rubocop-rails
|
||||||
|
ruby-prof
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
solargraph
|
solargraph
|
||||||
spring
|
spring
|
||||||
|
|
|
||||||
|
|
@ -99,4 +99,7 @@ RSpec.configure do |config|
|
||||||
Kernel.srand config.seed
|
Kernel.srand config.seed
|
||||||
|
|
||||||
config.example_status_persistence_file_path = 'specs_with_runtime.txt'
|
config.example_status_persistence_file_path = 'specs_with_runtime.txt'
|
||||||
|
|
||||||
|
# Run ruby-prof
|
||||||
|
Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f }
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
require 'ruby-prof'
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.around(:each) do |example|
|
||||||
|
profile = RubyProf::Profile.new
|
||||||
|
profile.start
|
||||||
|
example.run
|
||||||
|
result = profile.stop
|
||||||
|
|
||||||
|
printer = RubyProf::FlatPrinter.new(result)
|
||||||
|
printer.print(File.open("profile_#{example.full_description.parameterize}.txt", 'w+'))
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue