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
We share configuration in the rails_helper between different test suites with a gem. We would like to do the same for the rswag configuration.
We started of with moving the rswag config from swagger_helper to the rails_helper. Then we changed the swagger_helper to just require the rails_helper and do nothing else.
I wonder if it's possible somehow to change the swagger_formatter to not require the swagger_helper from the application.
We could also make it configurable which file to require: I tried around a bit with different options, but couldn't get to something that I am happy with. Here is what I tried:
Introduce a new setting like c.require_rails_helper which could be set to true and modify the require in the swagger-formatter. That didn't work as rswag-specs is not loaded when the require 'swagger_helper' is run.
Introduce an ENV var like REQUIRE_RAILS_HELPER which then is read before the require is executed. I didn't like this as it mixes two ways of configuration and is a bit magic.
Not try to make it configurable and fall back to rails_helper in case of a LoadError during the require. This is super magic and hacky and might not be wanted by other users.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there!
We share configuration in the rails_helper between different test suites with a gem. We would like to do the same for the rswag configuration.
We started of with moving the rswag config from swagger_helper to the rails_helper. Then we changed the swagger_helper to just require the rails_helper and do nothing else.
I wonder if it's possible somehow to change the swagger_formatter to not require the swagger_helper from the application.
We could also make it configurable which file to require: I tried around a bit with different options, but couldn't get to something that I am happy with. Here is what I tried:
Introduce a new setting like
c.require_rails_helper
which could be set to true and modify the require in the swagger-formatter. That didn't work as rswag-specs is not loaded when therequire 'swagger_helper'
is run.Introduce an ENV var like
REQUIRE_RAILS_HELPER
which then is read before the require is executed. I didn't like this as it mixes two ways of configuration and is a bit magic.Not try to make it configurable and fall back to rails_helper in case of a LoadError during the require. This is super magic and hacky and might not be wanted by other users.
Do you have other ideas what we could try?
Best wishes from Hamburg,
Nick
Beta Was this translation helpful? Give feedback.
All reactions