seedbank
seedbank copied to clipboard
RuntimeError: Don't know how to build task 'environment'
Hi,
I have a hook in my Rspec config to run my test seeds with Seedbank before my test suite runs. Worked great until I tried to upgrade Seedbank to 0.5.0, now I get this error:
An error occurred in a `before(:suite)` hook.
Failure/Error: Rake::Task["db:seed:test"].invoke
RuntimeError:
Don't know how to build task 'environment' (see --tasks)
# ./spec/rails_helper.rb:66:in `block (2 levels) in <top (required)>'
# -e:1:in `<main>'
Here are the relevant lines from my config:
RSpec.configure do |config|
# ...
config.before(:suite) {
Seedbank.load_tasks
Rake::Task["db:seed:test"].invoke
}
# ...
What is the recommended way of accomplishing this? I don't believe I can do Rails.application.load_seed
with Seedbank.
It works fine on 0.4.0.
Thanks!
Sorry I was traveling when you raised this. I’ll have a look and see if I can recreate the error.
Found a solution/workaround:
config.before(:suite) {
Rails.application.load_tasks
Seedbank.load_tasks
Rake::Task["db:seed:test"].invoke
}
@xtagon thanks for posting your workaround, this worked for me as well 👍