Trying to execute Thor test suite with rspec-expectations 3.11.0 + Ruby 3.1, I observe the following error:
1) Thor::Options#parse raises an error for unknown switches
Failure/Error: expect { check_unknown! }.to raise_error(Thor::UnknownArgumentError, expected)
expected Thor::UnknownArgumentError with "Unknown switches \"--baz\"\nDid you mean? \"--bar\"", got #<Thor::UnknownArgumentError: Unknown switches "--baz"
Did you mean? "--bar"> with backtrace:
# ./lib/thor/parser/options.rb:146:in `check_unknown!'
# ./spec/parser/options_spec.rb:17:in `check_unknown!'
# ./spec/parser/options_spec.rb:119:in `block (4 levels) in <top (required)>'
# ./spec/parser/options_spec.rb:119:in `block (3 levels) in <top (required)>'
# /usr/share/gems/gems/webmock-3.14.0/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'
# ./spec/parser/options_spec.rb:119:in `block (3 levels) in <top (required)>'
# /usr/share/gems/gems/webmock-3.14.0/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'
This brought me to the rspec/rspec-expectations#1339, which is the reason for the error message, but I don't think the reported error is correct. It should actually be:
expected Thor::UnknownArgumentError with "Unknown switches \"--baz\"\nDid you mean? \"--bar\"", got #<Thor::UnknownArgumentError: Unknown switches "--baz"> with backtrace:
IOW it should not mention the Did you mean? "--bar", because the original_message was used for the comparison. I think that this line should be adjusted.
This is the test case in question:
https://github.com/rails/thor/blob/ab3b5be455791f4efb79f0efb4f88cc6b59c8ccf/spec/parser/options_spec.rb#L112-L120
Trying to execute Thor test suite with rspec-expectations 3.11.0 + Ruby 3.1, I observe the following error:
This brought me to the rspec/rspec-expectations#1339, which is the reason for the error message, but I don't think the reported error is correct. It should actually be:
IOW it should not mention the
Did you mean? "--bar", because theoriginal_messagewas used for the comparison. I think that this line should be adjusted.This is the test case in question:
https://github.com/rails/thor/blob/ab3b5be455791f4efb79f0efb4f88cc6b59c8ccf/spec/parser/options_spec.rb#L112-L120