Island94 iconIsland94Sep 5, 2026

Converting a Ruby block interface to start/stop methods with a Fiber

One of the small joys of computer programming is reading some code and thinking aha, that's nice. I recently encountered this feeling of aha while reading the docs for the playwright-ruby-client 's set up code for Capybara which described a mismatch between the Playwright and RSpec interface:

Share this story

Send the public story page.

Useful takeaways from this story.

One of the small joys of computer programming is reading some code and thinking aha, that's nice.

I recently encountered this feeling of aha while reading the docs for the playwright-ruby-client 's set up code for Capybara which described a mismatch between the Playwright and RSpec interface:

The challenge is that Playwright.create and playwright.chromium.launch are block-scoped APIs — the browser shuts down when the block exits.

Building the complete brief

The page is ready to read now. The fuller skim-friendly version will appear here automatically.

The useful part

One of the small joys of computer programming is reading some code and thinking aha, that's nice. I recently encountered this feeling of aha while reading the docs for the playwright-ruby-client 's set up code for Capybara which described a mismatch between the Playwright and RSpec interface: The challenge is that Playwright.create and playwright.chromium.launch are block-scoped APIs — the browser shuts down when the block exits.

Details worth keeping

RSpec has before(:suite) and after(:suite) but no around(:suite). resumes the fiber until it yields the browser back, and stop! resumes it again so both blocks exit cleanly.

Keep reading in the app

Open the app view to save this story, compare related coverage, and continue from the same source.

Open in app