Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental Rack 3 support #2646

Merged
merged 2 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,29 @@ jobs:
bundler-cache: true
- name: Run tests inside a window manager
run: xvfb-run sh -c "fluxbox & bundle exec rake ${{ matrix.task }}; killall fluxbox"

rack_3:
runs-on: ubuntu-latest

env:
HEADLESS: true
BUNDLE_GEMFILE: gemfiles/Gemfile.rack3

strategy:
fail-fast: false
matrix:
ruby: ["3.2"]
task: ["spec_rack"]

steps:
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run smoke tests
run: bundle exec rake ${{ matrix.task }}


8 changes: 8 additions & 0 deletions gemfiles/Gemfile.rack3
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem 'bundler', '< 3.0'
gemspec path: '..'

gem 'rack', '~>3.0.0'
gem 'rackup'
gem 'sinatra', github: 'dentarg/sinatra', branch: 'rack-3'
4 changes: 4 additions & 0 deletions lib/capybara/registrations/servers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
end

Capybara.register_server :puma do |app, port, host, **options| # rubocop:disable Metrics/BlockLength
begin
require 'rackup'
rescue LoadError # rubocop:disable Lint/SuppressedException
end
begin
require 'rack/handler/puma'
rescue LoadError
Expand Down
4 changes: 2 additions & 2 deletions spec/rack_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ module TestSessions
driver = described_class.new(TestApp)

driver.visit('/redirect')
expect(driver.response.header['Location']).to be_nil
expect(driver.response.headers['Location']).to be_nil
expect(driver.current_url).to match %r{/landed$}
end

Expand All @@ -234,7 +234,7 @@ module TestSessions
driver = described_class.new(TestApp, follow_redirects: false)

driver.visit('/redirect')
expect(driver.response.header['Location']).to match %r{/redirect_again$}
expect(driver.response.headers['Location']).to match %r{/redirect_again$}
expect(driver.current_url).to match %r{/redirect$}
end
end
Expand Down