0

我正在使用 Ubuntu 12.04 64 位。我刚刚重新安装了操作系统并使用 RVM 安装了 Ruby/Rails。但是当我尝试运行 Rspec 测试时,我得到一个错误:

ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- spec_helper (LoadError)

我用命令生成了 spec_helper 文件:rails g rspec:install

我在 spec 目录下有 spec_helper 文件。有谁知道为什么它不起作用?

仅当我从 sublime text 2 运行测试时才会出现该错误。我已在此链接中添加了测试:https ://github.com/maltize/sublime-text-2-ruby-tests

我的宝石文件:

    source 'https://rubygems.org'

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

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

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

# 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

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]
4

1 回答 1

1

从命令行运行 Sublime Text 2

$ cd "to your app folder then"

$ subl .

这应该可以工作,他们在 https://github.com/maltize/sublime-text-2-ruby-tests中将其作为注释

于 2013-09-24T06:01:59.263 回答