-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial Minitest support #90
Conversation
Rough around the edges, but shows it can be done.
This minimizes code duplication between rspec and minitest integrations and adds specs for minitest. Feature-wise the minitest implementation is not yet on par with the rspec one. Custom metadata, `description_builder` and possibly other features are missing or will not be possible.
Remove unused variable and re-use `path_records` to be consistent with minitest integration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rubocop found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
Judging from the failed checks, I still do not have a way to guarantee a stable execution order of tests |
Make sure to get exact same results as request specs in every environemnt.
I made the ordering of tests explicit now, so it is 100% static. That should solve this issue. Also, I added support for constructing the path dynamically using a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late response.
LGTM 👍
I am going to fix trivial RuboCop warnings later.
It took me a while but I think I finally have something worth discussing. This PR builds upon my proof of concept mentioned in #88, streamlines the code a little bit and adds tests.
Notable changes
ResultRecorder
to move that code into so it can be shared. This makes the actual integrations a lot slimmer, which I think is very nice.RSpec::OpenAPI
module to collect thepath_records
. (A nice side-effect of the point mentioned above is thaterror_records
has moved to theResultRecorder
class and is not needed as a global variable anymore.)Unsolved issues
rspec
in the.gemspec
file. I had initially hoped that some kind of "soft dependency" would be possible, but there are a couple of issues with that. One is thatrspec-openapi
depends on and requires therspec
meta gem.rspec-rails
on the other hand does not depend on that, so in many typical rails apps usingrspec
you will not find it in the gem bundle. I tried a couple of things but to no avail. If anyone has any ideas how one could remove the hard dependency, so minitest users will not have to install rspec, without any breaking changes for existing users, I would be thankful.rspec-openapi
works the output heavily depends on the order in which the tests are executed. This is a problem with minitest, as it orders tests randomly during execution. The only other option is to order them alphabetically, which sadly does not match the order in the rspec request specs either. I had to patch minitest and reorder the tests to get the exact same output, which is not ideal imho. It makes the current tests very brittle. OTOH I love that they prove that both integrations can produce the exact same output. So maybe it is OK.Missing features
My goal was to produce something usable that can serve as a basis for discussion so there are a couple of features I intentionally did not implement. Most notably:
description_builder
will not work with minitest and I believe it never could because minitest has no concept of nested examples.Using aProc
to construct thepath
will not currently work. This is actually not an intentional omission, but something I overlooked and only just noticed. I might still look into adding support for this.