浏览代码

Profiling tools configuration improvement (#25383)

Matt Jankowski 10 月之前
父节点
当前提交
7581b1ff96
共有 4 个文件被更改,包括 16 次插入0 次删除
  1. 4 0
      Gemfile
  2. 4 0
      Gemfile.lock
  3. 0 0
      spec/fabricators/fabricators_spec.rb
  4. 8 0
      spec/rails_helper.rb

+ 4 - 0
Gemfile

@@ -177,10 +177,14 @@ group :development do
 
   # Validate missing i18n keys
   gem 'i18n-tasks', '~> 1.0', require: false
+end
 
+group :development, :test do
   # Profiling tools
   gem 'memory_profiler', require: false
+  gem 'ruby-prof', require: false
   gem 'stackprof', require: false
+  gem 'test-prof'
 end
 
 group :production do

+ 4 - 0
Gemfile.lock

@@ -644,6 +644,7 @@ GEM
       rubocop (~> 1.33)
       rubocop-capybara (~> 2.17)
       rubocop-factory_bot (~> 2.22)
+    ruby-prof (1.6.3)
     ruby-progressbar (1.13.0)
     ruby-saml (1.15.0)
       nokogiri (>= 1.13.10)
@@ -718,6 +719,7 @@ GEM
       unicode-display_width (>= 1.1.1, < 3)
     terrapin (0.6.0)
       climate_control (>= 0.0.3, < 1.0)
+    test-prof (1.2.1)
     thor (1.2.2)
     tilt (2.2.0)
     timeout (0.4.0)
@@ -891,6 +893,7 @@ DEPENDENCIES
   rubocop-performance
   rubocop-rails
   rubocop-rspec
+  ruby-prof
   ruby-progressbar (~> 1.13)
   rubyzip (~> 2.3)
   sanitize (~> 6.0)
@@ -908,6 +911,7 @@ DEPENDENCIES
   stackprof
   stoplight (~> 3.0.1)
   strong_migrations (~> 0.8)
+  test-prof
   thor (~> 1.2)
   tty-prompt (~> 0.23)
   twitter-text (~> 3.1.0)

+ 0 - 0
spec/fabricators_spec.rb → spec/fabricators/fabricators_spec.rb


+ 8 - 0
spec/rails_helper.rb

@@ -147,6 +147,14 @@ RSpec.configure do |config|
     Rails.cache.clear
     redis.del(redis.keys)
   end
+
+  # Assign types based on dir name for non-inferred types
+  config.define_derived_metadata(file_path: %r{/spec/}) do |metadata|
+    unless metadata.key?(:type)
+      match = metadata[:location].match(%r{/spec/([^/]+)/})
+      metadata[:type] = match[1].singularize.to_sym
+    end
+  end
 end
 
 RSpec::Sidekiq.configure do |config|