开发者

Rails 3 - How do I get Rspec spec/ & autotest to work?

I was all setup with Rspec and Autotest before I updated to开发者_运维百科 Rails 3.

When running rspec spec/ I'm getting:

* spec/spec.opts is deprecated.
* please use ./.rspec or ~/.rspec instead.

I tried changed spec.opts to spec.rspec and running rspec spec/ again. But now I get a whole mess of warnings:

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/.

Autotest isn't working either. I'm getting:

.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'

Any ideas?


The deprecation warnings are because of your upgrade to Rails 3, not because of RSpec. Rails 3 has a very different architecture, and the API has also changed significantly. Have you run your project through the rails_upgrade plugin? Also, check out the Rails 3 Release Notes for help on fixing the parts of your application that rely on deprecated functionality.

The second issue is probably because ruby 1.9.2 no longer puts the current directory on the load path. You'll need to manually include spec/ into the load path from your spec.opts.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜