Ok, I see where the second error comes from, namely the name not matching the file name? I see two alternative solutions:

* Stub the `basename` attribute of the `file` object,  e.g. `@linter.file.stubs(:basename).returns('ValidName')`, which is used [here](https://github.com/Kapin/Core/blob/2f06d5391356375a702df76afa0196d4aef09ec7/lib/cocoapods-core/specification/linter.rb#L210).
* Modify the `message_should_include` test helper to find any matching message among the results, making it index independent.

I think I hinge towards the latter.