在我更新到Rails3之前,我已经完成了Rspec和Autotest的所有设置。
当运行rspec spec/时,我得到:
* spec/spec.opts is deprecated.
* please use ./.rspec or ~/.rspec instead.我尝试将spec.opts更改为spec.rspec并再次运行rspec spec/。但现在我收到了一大堆警告:
DEPRECATION WARNING: Use toplevel init.rb; rails/init.rb is deprecated:
DEPRECATION WARNING: reset_javascript_include_default is deprecated. Please manipulate config.action_view.javascript_expansions[:defaults] directly.
DEPRECATION WARNING: RAILS_ENV is deprecated. Please use ::Rails.env.
DEPRECATION WARNING: Use toplevel init.rb; rails/init.rb is deprecated:
DEPRECATION WARNING: You are using the old router DSL which will be removed in Rails 3.1. Please check how to update your routes file at: http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/.自动测试也不起作用。我得到了:
.rvm/rubies/ruby-1.9.2-p0/bin/ruby -I.:lib:test -rubygems -e "['test/unit', 'spec/integration/layout_links_spec.rb', 'test/unit/color_test.rb', 'test/functional/products_controller_test.rb', 'spec/integration/users_spec.rb', 'test/functional/colors_controller_test.rb', 'test/unit/product_test.rb', 'test/unit/helpers/products_helper_test.rb', 'test/unit/helpers/colors_helper_test.rb'].each { |f| require f }" | .rvm/gems/ruby-1.9.2-p0/gems/autotest-4.3.2/bin/unit_diff -u:29:in require': no such file to load -- spec_helper (LoadError) from <internal:lib/rubygems/custom_require>:29:inrequire‘from spec/integration/layout_links_spec.rb:1:in <top (required)>' from <internal:lib/rubygems/custom_require>:29:inrequire’from :29:in require' from -e:1:inblock in‘from -e:1:in each' from -e:1:in’
有什么想法吗?
发布于 2010-10-11 05:29:52
不推荐使用的警告是因为您升级到了Rails3,而不是因为RSpec。Rails3有一个非常不同的架构,API也发生了很大的变化。你有没有通过rails_upgrade插件运行你的项目?此外,请查看Rails 3 Release Notes以获取有关修复应用程序中依赖于过时功能的部分的帮助。
第二个问题可能是因为ruby 1.9.2 no longer puts the current directory on the load path。您需要从spec.opts手动将spec/包含到加载路径中。
https://stackoverflow.com/questions/3892359
复制相似问题