Skip to content

Commit f857a99

Browse files
authored
Experimental Rack 3 support (#2646)
* Experimental Rack 3 support
1 parent 3883ded commit f857a99

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,29 @@ jobs:
154154
bundler-cache: true
155155
- name: Run tests inside a window manager
156156
run: xvfb-run sh -c "fluxbox & bundle exec rake ${{ matrix.task }}; killall fluxbox"
157+
158+
rack_3:
159+
runs-on: ubuntu-latest
160+
161+
env:
162+
HEADLESS: true
163+
BUNDLE_GEMFILE: gemfiles/Gemfile.rack3
164+
165+
strategy:
166+
fail-fast: false
167+
matrix:
168+
ruby: ["3.2"]
169+
task: ["spec_rack"]
170+
171+
steps:
172+
- uses: actions/checkout@v3
173+
174+
- name: Set up Ruby
175+
uses: ruby/setup-ruby@v1
176+
with:
177+
ruby-version: ${{ matrix.ruby }}
178+
bundler-cache: true
179+
- name: Run smoke tests
180+
run: bundle exec rake ${{ matrix.task }}
181+
182+

gemfiles/Gemfile.rack3

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source "https://rubygems.org"
2+
3+
gem 'bundler', '< 3.0'
4+
gemspec path: '..'
5+
6+
gem 'rack', '~>3.0.0'
7+
gem 'rackup'
8+
gem 'sinatra', github: 'dentarg/sinatra', branch: 'rack-3'

lib/capybara/registrations/servers.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
end
2020

2121
Capybara.register_server :puma do |app, port, host, **options| # rubocop:disable Metrics/BlockLength
22+
begin
23+
require 'rackup'
24+
rescue LoadError # rubocop:disable Lint/SuppressedException
25+
end
2226
begin
2327
require 'rack/handler/puma'
2428
rescue LoadError

spec/rack_test_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ module TestSessions
220220
driver = described_class.new(TestApp)
221221

222222
driver.visit('/redirect')
223-
expect(driver.response.header['Location']).to be_nil
223+
expect(driver.response.headers['Location']).to be_nil
224224
expect(driver.current_url).to match %r{/landed$}
225225
end
226226

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

236236
driver.visit('/redirect')
237-
expect(driver.response.header['Location']).to match %r{/redirect_again$}
237+
expect(driver.response.headers['Location']).to match %r{/redirect_again$}
238238
expect(driver.current_url).to match %r{/redirect$}
239239
end
240240
end

0 commit comments

Comments
 (0)