Skip to content

Commit

Permalink
Experimental Rack 3 support (#2646)
Browse files Browse the repository at this point in the history
* Experimental Rack 3 support
  • Loading branch information
twalpole committed Feb 13, 2023
1 parent 3883ded commit f857a99
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
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

0 comments on commit f857a99

Please sign in to comment.