Skip to content

Commit 0ac9957

Browse files
committed
DidYouMean::PlainFormatter is deprecated
1 parent dab72c5 commit 0ac9957

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

test/optparse/test_did_you_mean.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@ def setup
1212
@opt.def_option("--foo", Integer) { |v| @foo = v }
1313
@opt.def_option("--bar", Integer) { |v| @bar = v }
1414
@opt.def_option("--baz", Integer) { |v| @baz = v }
15-
@formatter = ::DidYouMean.formatter
16-
case @formatter
17-
when ::DidYouMean::PlainFormatter
18-
else
19-
::DidYouMean.formatter = ::DidYouMean::PlainFormatter.new
15+
unless ::DidYouMean::Formatter.respond_to?(:message_for)
16+
@formatter = ::DidYouMean.formatter
17+
case @formatter
18+
when ::DidYouMean::PlainFormatter
19+
else
20+
::DidYouMean.formatter = ::DidYouMean::PlainFormatter.new
21+
end
2022
end
2123
end
2224

2325
def teardown
24-
::DidYouMean.formatter = @formatter
26+
unless ::DidYouMean::Formatter.respond_to?(:message_for)
27+
::DidYouMean.formatter = @formatter
28+
end
2529
end
2630

2731
def test_no_suggestion

0 commit comments

Comments
 (0)