From 7581b1ff9664b90d1ba2cd75e7e332cc5bab4d36 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 28 Jul 2023 17:16:23 -0400 Subject: [PATCH] Profiling tools configuration improvement (#25383) --- Gemfile | 4 ++++ Gemfile.lock | 4 ++++ spec/{ => fabricators}/fabricators_spec.rb | 0 spec/rails_helper.rb | 8 ++++++++ 4 files changed, 16 insertions(+) rename spec/{ => fabricators}/fabricators_spec.rb (100%) diff --git a/Gemfile b/Gemfile index ff9a9cdb1..a9080060b 100644 --- a/Gemfile +++ b/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 diff --git a/Gemfile.lock b/Gemfile.lock index fda288c6f..151a37201 100644 --- a/Gemfile.lock +++ b/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) diff --git a/spec/fabricators_spec.rb b/spec/fabricators/fabricators_spec.rb similarity index 100% rename from spec/fabricators_spec.rb rename to spec/fabricators/fabricators_spec.rb diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 0f1073630..d4ff79c51 100644 --- a/spec/rails_helper.rb +++ b/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|