You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#323 introduces an OnlyRegexpLiteral option, which if enabled, resolves this issue. Unfortunately, it does so by simply allowing the offense, because the cop would have to follow the local variable to determine it's a Regexp.
When applying
Minitest/AssertMatch
(orMinitest/RefuteMatch
)'s auto-fix to the following the working code:Expected behavior
It would auto-correct
assert hello.match? greeting
toassert_match greeting, hello
.Indeed, it works correctly for
assert hello.match?(%r{World})
.Actual behavior
It auto-corrects
assert hello.match? greeting
toassert_match hello, greeting
(note the order of parameters), which causes the test to error:since it didn't swap the order of the parameters.
Steps to reproduce the problem
foo_test.rb
)ruby foo_test.rb
)rubocop -a foo_test.rb
)ruby foo_test.rb
)See the test error.
RuboCop version
The text was updated successfully, but these errors were encountered: