Skip to content
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

Force RAILS_ENV to be "test" in rake tasks #776

Merged
merged 1 commit into from Aug 28, 2020

Conversation

cgunther
Copy link
Contributor

@cgunther cgunther commented Aug 28, 2020

After #732, if you're using the SQL schema format, parallel:prepare now calls db:purge db:structure:load where it used to call db:test:prepare. The old task forced using the test environment, however the new tasks make no assumptions about the environment. Therefore, when combined with a Spring-ified rake binstub, where Spring defaults to the development environment, when parallel:prepare calls db:purge db:structure:load, they're running in the development environment against the development database, instead of in the test environment against the test database.

Now the environment is forced to be "test" in all rake tasks regardless of the RAILS_ENV that might have been set, whether by Spring or the user. This has the side-effect of removing the ability to run the tasks in a test-like environment that's named something other than "test".

I believe this fixes #768.

Checklist

  • Feature branch is up-to-date with master (if not - rebase it).
  • Added tests.
  • Added an entry to the Changelog if the new
    code introduces user-observable changes.
  • Update Readme.md when cli options are changed

After grosser#732, if you're using the SQL schema format, `parallel:prepare`
now calls `db:purge db:structure:load` where it used to call
`db:test:prepare`. The old task forced using the test environment,
however the new tasks make no assumptions about the environment.
Therefore, when combined with a Spring-ified rake binstub, where Spring
defaults to the development environment, when `parallel:prepare` calls
`db:purge db:structure:load`, they're running in the development
environment against the development database, instead of in the test
environment against the test database.

Now the environment is forced to be "test" in all rake tasks regardless
of the RAILS_ENV that might have been set, whether by Spring or the
user. This has the side-effect of removing the ability to run the tasks
in a test-like environment that's named something other than "test".

I believe this fixes grosser#768.
@grosser grosser merged commit 135673d into grosser:master Aug 28, 2020
@grosser
Copy link
Owner

grosser commented Aug 28, 2020

3.2.0

... worst case someone who has a strange dev environment will complain, let's see 🍿

@cgunther
Copy link
Contributor Author

Thanks for the quick merge/release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why this is trying to drop development database?
2 participants