Default DidYouMean.formatter to PlainFormatter
This commit is contained in:
parent
d4e52f672c
commit
e29e49abf0
@ -9,6 +9,11 @@ class TestOptionParser::DidYouMean < TestOptionParser
|
|||||||
@opt.def_option("--bar", Integer) { |v| @bar = v }
|
@opt.def_option("--bar", Integer) { |v| @bar = v }
|
||||||
@opt.def_option("--baz", Integer) { |v| @baz = v }
|
@opt.def_option("--baz", Integer) { |v| @baz = v }
|
||||||
@formatter = ::DidYouMean.formatter
|
@formatter = ::DidYouMean.formatter
|
||||||
|
case @formatter
|
||||||
|
when ::DidYouMean::PlainFormatter
|
||||||
|
else
|
||||||
|
::DidYouMean.formatter = ::DidYouMean::PlainFormatter.new
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
@ -22,7 +27,6 @@ class TestOptionParser::DidYouMean < TestOptionParser
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_plain
|
def test_plain
|
||||||
::DidYouMean.formatter = ::DidYouMean::PlainFormatter.new
|
|
||||||
assert_raise_with_message(OptionParser::InvalidOption, /invalid option: --baa\nDid you mean\?\s+baz\s+bar\Z/) do
|
assert_raise_with_message(OptionParser::InvalidOption, /invalid option: --baa\nDid you mean\?\s+baz\s+bar\Z/) do
|
||||||
@opt.permute!(%w"--baa")
|
@opt.permute!(%w"--baa")
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user