teamcapybara / capybara

Acceptance test framework for web applications
http://teamcapybara.github.io/capybara/
MIT License
10.03k stars 1.45k forks source link

Rails 7.2.1.2 error when running tests #2782

Open jason-hobbs opened 2 weeks ago

jason-hobbs commented 2 weeks ago

I just updated to Rails 7.2.1.2 which included an update to rackup 1.0.1. My app runs fine but when trying to run tests with the latest Capybara I am getting:

`#<Thread:0x0000000179b79970 /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/capybara-3.40.0/lib/capybara/server.rb:76 run> terminated with exception (report_on_exception is true): /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/rack/handler/puma.rb:126:in "": undefined method "register" for module Rackup::Handler (NoMethodError)

  register :puma, Puma
  ^^^^^^^^
    from /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/rack/handler/puma.rb:120:in "<module:Rackup>"
    from /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/rack/handler/puma.rb:119:in "<top (required)>"
    from /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in "require"
    from /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in "block (2 levels) in replace_require"
    from /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/zeitwerk-2.7.1/lib/zeitwerk/core_ext/kernel.rb:34:in "require"
    from /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/capybara-3.40.0/lib/capybara/registrations/servers.rb:27:in "block in <top (required)>"
    from /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/capybara-3.40.0/lib/capybara/config.rb:64:in "block in server="
    from /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/capybara-3.40.0/lib/capybara/server.rb:77:in "block in boot"

/Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/rack/handler/puma.rb:6: warning: already initialized constant Puma::RackHandler::DEFAULT_OPTIONS /Users/jasonhobbs/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/rack/handler/puma.rb:6: warning: previous definition of DEFAULT_OPTIONS was here`

edwinwills commented 1 week ago

This is actually an issue that's been fixed in Puma – https://github.com/puma/puma/pull/3532

Until they push a new release, you'll need to pull from HEAD

gem 'puma', github: 'puma/puma'

Hope that helps!