首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rails3-如何让Rspec spec/ & autotest工作?

Rails3-如何让Rspec spec/ & autotest工作?
EN

Stack Overflow用户
提问于 2010-10-09 00:11:57
回答 1查看 1.8K关注 0票数 2

在我更新到Rails3之前,我已经完成了Rspec和Autotest的所有设置。

当运行rspec spec/时,我得到:

代码语言:javascript
复制
* spec/spec.opts is deprecated.
* please use ./.rspec or ~/.rspec instead.

我尝试将spec.opts更改为spec.rspec并再次运行rspec spec/。但现在我收到了一大堆警告:

代码语言:javascript
复制
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/.

自动测试也不起作用。我得到了:

代码语言:javascript
复制
.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

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 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/包含到加载路径中。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3892359

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档