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 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.') )