开发者

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

开发者 https://www.devze.com 2023-01-24 02:22 出处:网络
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:

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

精彩评论

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