Skip to content
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

RuntimeError: Don't know how to build task 'environment' #80

Open
xtagon opened this issue Jan 9, 2019 · 3 comments
Open

RuntimeError: Don't know how to build task 'environment' #80

xtagon opened this issue Jan 9, 2019 · 3 comments

Comments

@xtagon
Copy link

xtagon commented Jan 9, 2019

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!

@james2m
Copy link
Owner

james2m commented Jan 26, 2019

Sorry I was traveling when you raised this. I’ll have a look and see if I can recreate the error.

@xtagon
Copy link
Author

xtagon commented Jul 14, 2022

Found a solution/workaround:

config.before(:suite) {
  Rails.application.load_tasks
  Seedbank.load_tasks
  Rake::Task["db:seed:test"].invoke
}

@rc-iwoodley
Copy link

@xtagon thanks for posting your workaround, this worked for me as well 👍

gregorbg referenced this issue in gregorbg/worldcubeassociation.org Mar 1, 2023
gregorbg referenced this issue in gregorbg/worldcubeassociation.org Mar 1, 2023
gregorbg referenced this issue in gregorbg/worldcubeassociation.org Mar 18, 2023
gregorbg referenced this issue in gregorbg/worldcubeassociation.org Mar 18, 2023
gregorbg referenced this issue in gregorbg/worldcubeassociation.org Mar 18, 2023
gregorbg referenced this issue in thewca/worldcubeassociation.org Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants