Do not override RAILS_ENV variable if already defined#210
Do not override RAILS_ENV variable if already defined#210arielj wants to merge 1 commit intoshakacode:masterfrom
Conversation
WalkthroughThe initialization of the RAILS_ENV environment variable in the Cypress on Rails server was modified from unconditional assignment to conditional assignment using the ||= operator, preserving any pre-existing RAILS_ENV configuration. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.