-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Issues loading specific seeds #95
Comments
It's a typo that I meant to fix a while ago, but forgot. We do support `db/seeds/test/**` loading, but the directory should match the `Rails.env` name like `test` singular. Ref #95
It's a typo that I meant to fix a while ago, but forgot. We do support `db/seeds/test/**` loading, but the directory should match the `Rails.env` name like `test` singular. Ref #95
Yeah, that's a typo. I spotted it a while ago, but then forgot to fix it. I just fixed it in #97.
The nesting is on purpose, since |
Hm. I haven't used RSpec much personally, so I'm wondering about RSpec specific documentation maintenance in general. I suppose we could add that snippet. |
Ref #95 Needs a `type: :feature` too to match the integration example above.
Ok, documenting the RSpec version in #98 |
Yeah, we should probably raise in case no files are found. |
Ref #95 Needs a `type: :feature` too to match the integration example above.
* Raise when `seed` finds no files. Ref #95 In case users pass a typo'ed name/path to `seed` we won't give them any indication of what's going on. Running a test fails silently. Now we raise when we can't find any files. * Split glob per path pattern In case a user does `seed :accounts, :missing` we want to raise when we can't load from `:missing`. Previously, we'd proceed silently because `:accounts` found files.
After #99, we're now raising in case a pattern can't be found. So for |
We were actually thinking that reusing special cases between dev/test makes a lot of sense for us. The case of pagination is a good example. When we want to develop on a pagination feature, it is usually a hassle to create all the objects needed to force the pagination to work, so instead by including it in the default seed, all developers would have easy access to the case. This is even more true when the cases get more esoteric and difficult to setup. So we were planning on adding something like the following in
|
Ahh, I see! That's interesting.
Ah yeah, I can see what you mean. I think I'd do this: if Rails.env.development?
seed :cases # Loads from db/seeds/cases/**/* and db/seeds/development/cases/**/*
end This lets you add shared and development specific cases without needing to update I'll need to think about this more and I probably want to document this in the README too. |
Ok, I just used a |
I had some small issues loading specific seeds. Some documentation issues and one bug.
Wrong path suggested?
The docs suggest using
db/seeds/tests/cases
. I didn't get that to work, instead I useddb/seeds/cases
. In the dummy app, the seeds are put underdb/seeds/test/cases
(note the lackings
). However, since the rest of the list is without the specific environment, I think it would make sense to just usedb/seeds/cases
in the documentation here?Add rspec suggestion
The documentation only suggests how to load seeds from minitest, should we add it for rspec as well?
seed silently fails on missing file
Since I had the wrong path (due to the first documentation issue) my tests failed, but it took me a while to figure out because
seed
silently fails if it doesn't find the file. I think it would have been easier to figure out if it complained on missing files.The text was updated successfully, but these errors were encountered: