Closed sjackson closed 1 year ago
Shouldn't spec_helper
take care of setting this environment variable?
What difference does running in docker make? As opposed to running without docker?
Hi, good questions.
I explicitly set the environment in my docker container and the spec_helper only sets the environment to test if it is not set.
Actually running in docker is not the problem, it is the same if you run outside of docker.
So the real problem is if the RAILS_ENV is set running rspec doesn't change it.
I have changed the question to better reflect the true problem.
Thanks for pointing out my mistake.
So the real problem is if the RAILS_ENV is set running rspec doesn't change it.
Is it changed when you run it from the command line?
Sorry, I'm asking these questions to understand where your expectations are coming from. Does some other editor have a test runner feature that behaves in the way you're describing?
Otherwise, perhaps the problem is that you do set RAILS_ENV
in your container globally.
Yes the problem is setting the RAILS_ENV variable, i removed and everything works as expected
This caused me many headaches so I modified the rspec_spec_command to force the test environment. I changed to RAILS_ENV=test rspec and everything worked.
Hope this helps anyone who is having the same problem