jump to navigation

No output from rake spec June 18, 2011

Posted by Paolo Montrasio in Technology and Software.
trackback

I created a new Rails project, wrote some tests with rspec, run rake spec and got no output, only a single “** Invoke spec (first_time, not_needed)” line.

After a lot of googling and after learning a lot of things that nevertheless didn’t solve the problem I finally found this thread with the solution: add gem “rspec-rails” to the development group in the Gemfile.

I don’t why I should need the rspec gem in the development environment when rake spec runs in the test one (add “puts Rails.env” in one of your spec files and see) but that’s it. I tried to outsmart the framework and lost half an hour. I hope this will help somebody to google the solution faster!

Advertisement

Comments»

1. meandre - July 18, 2011

this is really very very simple
in general you’re in development environment. from there u wish to launch rake spec, but there is no rspec-rails dependency for this env, so the task is not found.
environment-specific dependencies are specified in Gemfile with ‘group’ method and they influence which libs are being required at Rails startup.
so the correct way to specify dependency would be:
group :development, :test do
# RSpec-Rails testing framework
gem ‘rspec-rails’, ‘~> 2.6.1′
end


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.