LoadError:无法加载这样的文件 - spec / rake / spectask Fedena

时间:2014-09-02 11:37:22

标签: ruby-on-rails ruby rspec gem

:~/Documents/fedena/fedena-v2.3-bundle-linux$ rake db:create
rake aborted!
LoadError: cannot load such file -- spec/rake/spectask
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/home/cool_admin/Documents/fedena/fedena-v2.3-bundle-linux/lib/tasks/rspec.rake:22:in `<top (required)>'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `block in load_with_new_constant_marking'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load_with_new_constant_marking'
/var/lib/gems/1.9.1/gems/rails-2.3.5/lib/tasks/rails.rb:9:in `block in <top (required)>'
/var/lib/gems/1.9.1/gems/rails-2.3.5/lib/tasks/rails.rb:9:in `each'
/var/lib/gems/1.9.1/gems/rails-2.3.5/lib/tasks/rails.rb:9:in `<top (required)>'
/home/cool_admin/Documents/fedena/fedena-v2.3-bundle-linux/Rakefile:12:in `<top (required)>'
(See full trace by running task with --trace)
---------------------------------------------------------
~/Documents/fedena/fedena-v2.3-bundle-linux$ rake db:create --trace
rake aborted!
LoadError: cannot load such file -- spec/rake/spectask
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/home/cool_admin/Documents/fedena/fedena-v2.3-bundle-linux/lib/tasks/rspec.rake:22:in `<top (required)>'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `block in load_with_new_constant_marking'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load_with_new_constant_marking'
/var/lib/gems/1.9.1/gems/rails-2.3.5/lib/tasks/rails.rb:9:in `block in <top (required)>'
/var/lib/gems/1.9.1/gems/rails-2.3.5/lib/tasks/rails.rb:9:in `each'
/var/lib/gems/1.9.1/gems/rails-2.3.5/lib/tasks/rails.rb:9:in `<top (required)>'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/cool_admin/Documents/fedena/fedena-v2.3-bundle-linux/Rakefile:12:in `<top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/var/lib/gems/1.9.1/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'

1 个答案:

答案 0 :(得分:2)

您似乎已从RSpec 1升级到RSpec 2.您需要更新Rakefile以使用新的require格式:

<强> rspec的-1

require 'spec/rake/spectask'

Spec::Rake::SpecTask.new do |t|
  t.spec_opts = ['--options', "\"spec/spec.opts\""]
  t.spec_files = FileList['spec/**/*.rb']
end

<强> rspec的-2

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new do |t|
  t.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
  t.pattern = 'spec/**/*_spec.rb'
end

有关升级RSpec的更多信息,请访问:

https://www.relishapp.com/rspec/rspec-core/docs/upgrade