Ensure db:seed runs before spree_sample:load
Summary
When running bundle exec rake spree_sample:load against an empty database, an exception is raised in db/samples/tax_rates.rb on account of missing a Spree::Zone with the name "North America.
In this PR we:
- Add
db:seedas a dependent task ofspree_sample:load - Check that
Spree::Zone"North America" is present indb/samples/tax_rates.rbbefore running the rest of the seed file. This makes it consistent with db/samples/shipping_methods.rb
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
- [x] I have written a thorough PR description.
- [x] I have kept my commits small and atomic.
- [x] I have used clear, explanatory commit messages.
The following are not always needed:
Thanks! I left a comment. Also, I'm curious about what happens if
db:seedandsample:loadare run independently, one after the other. Isdb:seedexecuted twice in that case?
It will run db:seed twice in that case. I checked on this and I can confirm that the current seeds can be run multiple times without raising errors or duplicating data.
@lsizani do you know if we have any spec that verify we can run seeds multiple times without breaking or creating duplicate records?
@lsizani do you know if we have any spec that verify we can run seeds multiple times without breaking or creating duplicate records?
We do not... But I'm sure I can write one
Hey @lsizani! I lost track of this PR, I didn't notice you updated it following my suggestions. I will re-review it now, in the meantime there are some conflict with the main branch to address, if you have time for a rebase. Thanks again!