When developing PR #189, tests were changed to use new rspec-rubocop syntax which also checks that the message generated is correct. After doing this, the spec that checks that an error is returned when using "<<" static methods and a non-matching name failed with an incorrect message:
Method baz should be defined in foo/foo.rb
When the expected message was:
Method baz should be defined in foo.rb
After digging a little about it to understand what was happening, we realized that this incorrect message is also present on master – but there are no assertions respecting the offense's text, thus the test succeeds.
The issue seems to be caused by the method normalize_module_name(node.parent_module_name) (on module_method_in_wrong_file.rb#L88) which returns Foo::Foo instead of just Foo.
When developing PR #189, tests were changed to use new
rspec-rubocopsyntax which also checks that the message generated is correct. After doing this, the spec that checks that an error is returned when using "<<" static methods and a non-matching name failed with an incorrect message:Method baz should be defined in foo/foo.rbWhen the expected message was:
Method baz should be defined in foo.rbAfter digging a little about it to understand what was happening, we realized that this incorrect message is also present on
master– but there are no assertions respecting the offense's text, thus the test succeeds.The issue seems to be caused by the method
normalize_module_name(node.parent_module_name)(on module_method_in_wrong_file.rb#L88) which returnsFoo::Fooinstead of justFoo.