rspec / rspec-rails

RSpec for Rails 6+
https://rspec.info
MIT License
5.14k stars 1.03k forks source link

Pin selenium-webdriver to fix a warning #2766

Closed pirj closed 2 weeks ago

pirj commented 2 weeks ago

Rails 7.1 is unaware of the new API and this crashes our CI, eg https://github.com/rspec/rspec-rails/actions/runs/9552072568/job/26328604445?pr=2765

pirj commented 2 weeks ago

2.7 is broken with a uninitialized constant Gem apparently causing Puma not to get loaded.

pirj commented 2 weeks ago

Which is confusing, as it seems to load rack/handler/puma, but the Rack::Handler is not loaded. In Puma 5, that file was loading rack/handler and defined Rack::Handler::Puma, but in 6.x this happens only if Rackup is not loaded. But the comment says that rackup was removed from rack 3, and evidently we install rack 3.

pirj commented 2 weeks ago

I’ve merged this as it fixes Ruby 3.x builds with Rails 7.1. Ruby 2.7 with Rails 7.1 runs into a different issue, which I hope to look into next.

pirj commented 2 weeks ago

In both cases, for 2.7 and for 3.x with Rails 7.1, we bundle puma 6.4.2 and also rackup 2.1.0. This means, Rack::Handler::Puma should not be defined. Unless there’s some race condition/load order dependency and we: 1) load rack/handler 2) load puma’s rack/handler/puma 3) (optionally) load rackup. Where does the rackup dependency even come from?

pirj commented 2 weeks ago

The uninitialized constant Gem (NameError) can be caused by module Gem::Deprecate that was later changed into a nested declaration. But this change is 11 years old, why it’s not in rubygems 3.5.9 or 3.4.22 that are recent? 🤔 It appeared in 3.5.10 in this PR. Apparently, the namespace definition was collapsed here more than a decade ago. I hope this is just a warning with no consequences.

pirj commented 2 weeks ago

What’s interesting is that in another file there's similar code, but it suggests that rack > 3 must be used with rackup gem. This whole problem seems due to rack::handler not being loaded when capybara registers its puma server, and puma registers itself as a rack handler. Wondering, what makes a difference between 2.7 and 3.x?

JonRowe commented 2 weeks ago

The problem is capybara fixed this in 3.40.0 but also pinned the base ruby version to 3.0