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

Don't know how to build task 'spec:models' (see --tasks) #1776

Closed
alexbrinkman opened this issue Jan 19, 2017 · 5 comments
Closed

Don't know how to build task 'spec:models' (see --tasks) #1776

alexbrinkman opened this issue Jan 19, 2017 · 5 comments

Comments

@alexbrinkman
Copy link

When running rake spec:models I get the error:

"Don't know how to build task 'spec:models' (see --tasks) "

Even though rake -AT produces:

...
rake spec # Run all specs in spec directory (excluding plugin specs)
rake spec:controllers # Run the code examples in spec/controllers
rake spec:features # Run the code examples in spec/features
rake spec:helpers # Run the code examples in spec/helpers
rake spec:models # Run the code examples in spec/models
rake spec:prepare #
rake spec:statsetup #
...

Rails 5.0.1/Ruby 2.4/rspec-rails 3.5.1

I don't know if this is an rspec-rails issue, or a rake issue perhaps, or my own config issue??

@JonRowe
Copy link
Member

JonRowe commented Jan 21, 2017

I'd say somehow the rake task file isn't being detected by rake, what happens if you manually require 'rspec/rails/tasks/rspec.rake' in your Rakefile?

@alexbrinkman
Copy link
Author

Here's what my Rakefile looks like after the change:

require_relative 'config/application'
require 'rspec/rails/tasks/rspec.rake'

Rails.application.load_tasks

But then just running the rake command gives:
LoadError: cannot load such file -- rspec/rails/tasks/rspec.rake

I'm using rvm and my gems are in a gemset, does that change what the path should be? Thanks for the help!

@JonRowe
Copy link
Member

JonRowe commented Jan 22, 2017

Drat, you probably need the full path to include the file as it's not a ruby file. I'm pretty sure this is an issue with how Rake and Rails are interacting to include the file though.

@urkle
Copy link
Contributor

urkle commented Mar 28, 2017

@alexbrinkman did you add rspec-rails to your :development environment as well in your gem file? or just your :test environment?

If I have rspec-rails only in the :test group, then the rake tasks do not work. But if I move it to :development, :test they work correctly.

@alexbrinkman
Copy link
Author

@urkle - Thanks for the information, that worked. I added rspec-rails to my development group too. Previously it was just in test. Thanks so much!

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