From 573baa70de51471e1262b74b2aad36c9420b0de1 Mon Sep 17 00:00:00 2001 From: Luke Hill <20105237+luke-hill@users.noreply.github.com> Date: Tue, 7 Apr 2026 19:25:09 +0100 Subject: [PATCH 1/2] V11/deprecate ask (#1842) * Add deprecation for ask * Simplify deprecation spec --- lib/cucumber/runtime/user_interface.rb | 13 +++++++++++++ spec/cucumber/cucumber_spec.rb | 2 -- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/cucumber/runtime/user_interface.rb b/lib/cucumber/runtime/user_interface.rb index 433ef8273..65da3a727 100644 --- a/lib/cucumber/runtime/user_interface.rb +++ b/lib/cucumber/runtime/user_interface.rb @@ -21,6 +21,7 @@ module UserInterface # that makes a sound before invoking #ask. # def ask(question, timeout_seconds) + Cucumber.deprecate(ask_deprecation_message, 'Cucumber::Runtime#ask (From UserInterface Module)', 'v12') $stdout.puts(question) $stdout.flush puts(question) @@ -47,6 +48,18 @@ def attach(src, media_type, filename) private + def ask_deprecation_message + <<~MESSAGE + The `#ask` method has been present in cucumber for a while, but its purpose outside of cucumber is + questionable. It is being deprecated and will be removed in a future version (Targeting v12). + + If you are using it in your own code, you should remove the dependency on it and implement your own version + of it. If you are using it in a step definition, you should consider whether that is really necessary and + use either a conditional waiter or use a tag so that the scenario doesn't automatically run in a CI + environment where there is no operator to answer the question. + MESSAGE + end + def mri_gets(timeout_seconds) Timeout.timeout(timeout_seconds) do $stdin.gets diff --git a/spec/cucumber/cucumber_spec.rb b/spec/cucumber/cucumber_spec.rb index 232b44992..5d9c3999a 100644 --- a/spec/cucumber/cucumber_spec.rb +++ b/spec/cucumber/cucumber_spec.rb @@ -3,8 +3,6 @@ RSpec.describe Cucumber do describe '.deprecate' do it 'outputs a message to $stderr' do - allow(Kernel).to receive(:warn) - expect(Kernel).to receive(:warn).with( a_string_including('WARNING: #some_method is deprecated and will be removed after version 1.0.0. Use #some_other_method instead.') ) From 50d245fcc1f8e6e5efde7e62015e2ab13306b004 Mon Sep 17 00:00:00 2001 From: Luke Hill Date: Fri, 15 May 2026 17:20:18 +0100 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca632533b..1f554235c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) for more info on how to contribute to Cucumber. ## [Unreleased] +### Changed +- `Cucumber::Runtime#ask` which has not been actively supported is now deprecated (Should you wish to delay things +and wait for input, either use a tool like `pry` or add a hard-coded `sleep`) ([#1842](https://github.com/cucumber/cucumber-ruby/pull/1842)) [luke-hill](https://github.com/luke-hill)) ## [11.0.0] - 2026-04-14 ### Added