Problem
During testing with Capybara, I use binding.irb to pause the process temporarily.
At that time, I modify the code and reload the browser.
The reload time is very long and I would like to know the cause and how to improve it.
gif about this issue
*The .mov
format of the same video can be found in the github readme.
(GitHub - kohheepeace/rails_capybara_reload_issue)
I’m not entirely sure what the cause is, but I was wondering if Zeitwerk might be related, so mentioning @fxn
Motivation
I would like to be able to achieve a cypress-like TDD experience, to see code changes instantly during test.
Repo
Environment
- ruby “3.2.2”
- rails (7.1.3.2)
- rspec-core (3.13.0)
- capybara (3.40.0)
Steps
- set
config.enable_reloading = true
in `config/environments/test.rb
Rails.application.configure do
...
config.enable_reloading = true
...
end
- call
binding.irb
in system spec
spec/system/example_spec.rb
require 'rails_helper'
RSpec.describe 'example', type: :system do
before do
driven_by :selenium, using: :chrome, screen_size: [600, 600]
end
describe '#root' do
it 'works as expected' do
visit posts_path
binding.irb # 👈 here
end
end
end
- change the view code and reload browser.
Thanks !