Question

Im trying to install the rspec framework for TDD and BDD testing, and also the autotest gem for a continuos testing running at the same time the changes are done.

I have been following all kind of tutorials, some of them here in stack overflow and others out there in the web, but i couldnt reach a solution, when executing the

rails generate rspec:install

it throws me an error 'Could not find generator rspec:install'.

I attach the gem file here: [UPDATED]

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

group :development, :test do 
    gem 'rspec-rails', '2.13.1' 
end
Was it helpful?

Solution 2

Change what you have in your Gemfile to what is below and save

 group :development, :test do
   gem 'rspec-rails', '2.13.1'
 end

Then run bundle update and then bundle install

OTHER TIPS

The accepted answer didn't work for me. Here's what did:

Try this command:

spring stop

then run again:

rails generate rspec:install

in the gem file, instead of adding

gem 'rspec', '~> 3.1.0'

to your selected environment, add

gem 'rspec-rails', '~> 3.1.0'

spring stop fixed it for me.

possibly related:

https://github.com/rails/spring/issues/486

Rails Spring breaking generators

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top