开发者

How do I ensure that Rails does not generate test Test::Unit tests when I use a generator?

I am using RSpe开发者_开发问答c, but Rails insists on generating Test::Unit tests. Maybe there is a configuration I missed?


if you are using rails 2 then you do:

ruby script/generate rspec_model Foo

using Rails 3 check out this example:

http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3


If you're using Rails 3, you need the rspec-rails integration gem from github: https://github.com/rspec/rspec-rails

The instructions are there on Github, but you will need to run

script/rails generate rspec:install

From the README:

"RSpec is registered with Rails as the test framework, so whenever you generate application components like models, controllers, etc, RSpec specs are generated instead of Test::Unit tests."

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜