Search code examples
ruby-on-rails-4rspecrspec-rails

rails 4 - Could not find generator rspec:install


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

Solution

  • 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