Task and task spec fixes#1224
Merged
jhawthorn merged 4 commits intosolidusio:masterfrom Jun 13, 2016
Merged
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.
Contributor
|
This looks good to me 👍 A few additional thoughts:
|
Contributor
Author
|
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. |
Contributor
Author
|
Added a commit to rename assure -> ensure. |
Contributor
Author
|
@mamhoff any thoughts on moving this to a migration? |
3 tasks
Contributor
|
Thanks Jordan 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See individual commits:
aborttoraisein "assure_store_on_orders"