-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Task and task spec fixes #1224
Task and task spec fixes #1224
Conversation
925d8e6
to
5851565
Compare
Our specs were running each rake task multiple times, for a couple different reasons. While this is great to ensure that rake tasks are safe to run multiple times, that probably wasn't the intention. :) First problem: Loading the rake tasks in a `before` block meant that we call `Rails.application.load_tasks` multiple times. And that meant that a single task would get run multiple times. e.g.: - spec example 1 - runs its task one time. - spec example 2 - runs its task two times. - spec example 3 - runs its task three times. - ... Second problem: `Rails.application.load_tasks` doesn't seem to work correctly in specs. For some reason it causes rake tasks to run exactly twice. So even if we avoid the previous problem mentioned above, we'd still run each task two times. This commit adds a "rake" shared_context that fixes these problems. It also adds a dummy_task_spec that tests the above issues when using the shared context.
Missing the `Spree::` prefix. Also add some specs for the rake task.
Otherwise specs don't run properly and any configured exception handlers may not be triggered. And add specs.
This looks good to me 👍 A few additional thoughts:
|
I think a migration could make sense here. Our store needs this rake task because in Solidus < 1.3 a store is only added if the Solidus-provided controllers are used to generate orders. Our app doesn't use those controllers so we have lots of orders without store ids. |
Added a commit to rename assure -> ensure. |
@mamhoff any thoughts on moving this to a migration? |
Thanks Jordan 👍 |
See individual commits:
abort
toraise
in "assure_store_on_orders"