我正在尝试安装用于TDD和BDD测试的 rspec框架,以及用于在完成更改的同时运行的连续测试的 autotest gem。
我一直在关注所有类型的教程,其中一些在堆栈溢出,其他一些在网上,但我无法达成解决方案,执行
rails生成rspec:install
它引发了我的错误'无法找到生成器rspec:install' 。
我在这里附上了宝石文件:[更新]
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
答案 0 :(得分:11)
接受的答案对我不起作用。这是做了什么:
尝试此命令:
spring stop
然后再次运行:
rails generate rspec:install
答案 1 :(得分:3)
将Gemfile中的内容更改为以下内容并保存
group :development, :test do
gem 'rspec-rails', '2.13.1'
end
然后运行bundle update,然后捆绑安装
答案 2 :(得分:3)
在gem文件中,而不是添加
gem 'rspec', '~> 3.1.0'
到您选择的环境中,添加
gem 'rspec-rails', '~> 3.1.0'
答案 3 :(得分:0)