Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/cucumber/runtime/user_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions spec/cucumber/cucumber_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
)
Expand Down
Loading