就像标题所说的那样,当我尝试运行我的 rspec 测试时,我遇到了上述错误。确切的错误是(为便于阅读而换行):
/.rvm/gems/ruby-1.9.3-p374/gems/test-unit-2.4.8/lib/test/unit/testcase.rb:93:in
`<class:TestCase>': uninitialized constant
Test::Unit::TestCase::Assertions (NameError)
互联网上这个问题的主要解决方法似乎是删除“转”宝石,但是我没有加载转宝石。这是我的 Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'devise'
gem 'therubyracer'
gem 'mysql2'
gem 'cucumber'
gem 'email_spec'
gem 'cancan'
gem 'rolify'
gem 'libv8'
gem 'simple_form'
group :test, :development do
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'test-unit'
end
group :test do
gem 'cucumber-rails', :require => false
gem 'capybara'
gem 'database_cleaner'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass'
gem 'sass-rails', '~> 3.2.3'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
测试似乎令人窒息的代码部分是当我的 rspec_helper.rb 文件中的 require 'rspec/rails' 中有这一行时。
这个项目曾经完美地运行 rspecs。只有当我重新安装我的操作系统时,它才开始表现不佳。
任何帮助是极大的赞赏