Skip to content

Add option to rspec:install generator to configure for Selenium in Docker #2878 #2886

Open
nicolasva wants to merge 2 commits intorspec:mainfrom
nicolasva:configure_selenium_docker
Open

Add option to rspec:install generator to configure for Selenium in Docker #2878 #2886
nicolasva wants to merge 2 commits intorspec:mainfrom
nicolasva:configure_selenium_docker

Conversation

@nicolasva
Copy link

@nicolasva nicolasva commented Feb 24, 2026

issue : #2878

changes :
4 files modified/created:

  1. [install_generator.rb]
    class_option :selenium_container (string, nil by default)
    Public method copy_system_test_configuration that generates the support file when the option is provided
    Private helper selenium_container
  2. [system_test_configuration.rb]— ERB template that generates an RSpec.configure block with:
    served_by + remote driven_by when CAPYBARA_SERVER_PORT is set (Docker mode)
    Fallback to driven_by :selenium, using: :headless_chrome locally
  3. [install_generator_spec.rb] — 7 new tests covering:
    File generation when option is provided
    Container hostname, served_by, remote driven_by, local fallback
    Custom hostname (e.g. --selenium-container=chrome)
    No file generated without the option
  4. [Changelog.md] — New entry under the Development section

Usage:
rails generate rspec:install --selenium-container=selenium
Then uncomment the spec/support/**/*.rb glob in rails_helper.rb to auto-load the configuration.

Copy link
Member

@JonRowe JonRowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this, I'd like to see some improvements to the specs but otherwise this is fine.

@nicolasva nicolasva requested a review from JonRowe March 12, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants