如何删除单元测试并将其替换为 rspec? [英] How to remove unit test and replace it with rspec?
问题描述
我有一个 rails 应用程序,它是使用默认测试单元设置的,如何删除它并使用 rspec 代替?(我没有写任何测试,我只是在应用生成过程中没有忽略它).
I have a rails app, that is setup with the default test unit, how can I remove it and use rspec instead? (I don't have any tests written, I just didn't ignore it during app generation).
推荐答案
实际上您可以同时使用任意数量的测试框架.例如,您可以使用cucumber、rspec、test-unit 和mini-test,它们都可以正常运行而不会相互影响.要在 rails 中使用 rspec,只需将以下内容添加到您的 Gemfile 中:
You can actually have any number of testing frameworks in use at the same time. For example, you can use cucumber, rspec, test-unit and mini-test and they will all function without stepping on each other's feet. To use rspec in rails simply add the following to your Gemfile:
group :development, :test do
gem 'rspec-rails'
end
然后更新或安装您的包并运行以下命令来设置 rspec:
Then update or install your bundle and run the following command to setup rspec:
rails generate rspec:install
您可以在此处找到更多信息.
You can find more information here.
这篇关于如何删除单元测试并将其替换为 rspec?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!