Skip to content

Commit

Permalink
Local-friendly RSpec setup (rubyforgood#5989)
Browse files Browse the repository at this point in the history
* Enable reloading for local spec runs

Allows running bin/rspec for developers, should not affect CI.

* Exclude gems from rspec failure backtrace

Can be overridden with `--backtrace` option.

* typo

Co-authored-by: Yuri Bocharov <[email protected]>

---------

Co-authored-by: Yuri Bocharov <[email protected]>
  • Loading branch information
thejonroberts and elasticspoon authored Aug 21, 2024
1 parent b391581 commit 41bfcc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
# recommended that you enable it in continuous integration systems to ensure eager
# loading is working properly before deploying your code.
config.eager_load = ENV["CI"].present?
# cache classes on CI, but enable reloading for local work (bin/rspec)
config.enable_reloading = ENV["CI"].blank?

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
Expand Down
6 changes: 6 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@

config.example_status_persistence_file_path = "#{::Rails.root}/tmp/persistent_examples.txt"

# Filter backtraces to gems that are not under our control.
# Can override using `--backtrace` option to rspec to see full backtraces.
config.filter_rails_from_backtrace!
config.filter_gems_from_backtrace(*%w[
bootsnap capybara factory_bot puma rack railties shoulda-matchers
sprockets-rails pundit
])

config.disable_monkey_patching!

Expand Down

0 comments on commit 41bfcc9

Please sign in to comment.