Do not override RAILS_ENV variable if already defined #210
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR has a small change to allow using a different Rails environment for the server started by Cypress.
The reason for this is that it's common to have some things disabled for unit tests when running in the
testenvironment and we don't want to disable them for the e2e tests. I know something could be achieved in some cases using theENV["CYPRESS"]env variable, but that would only apply for code that runs after that env variable is set. If we want to add some gem only when running e2e tests and not for other tests we can't do this currently.With this change we could have gems in an
e2egroup when needed, and then runRAILS_ENV=e2e rails cypress:run.More context:
I found this issue with this sample app https://github.com/fastruby/coverage-with-cypress-sample-app. I'm using Coverband to calculate the Ruby code coverage after running the Cypress tests, but since it runs in the
testenvironment, Coverband is also initialized for therails testMinitest test suite and an error shows up at the end:With the change of this PR, I can add the coverband gem in an
e2egroup so it works properly without being loaded for minitest.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.