[英]Rails generated app without tests, how can i generate rspec test files without recreating project?
我使用 Rails 生成了仅 API 的应用程序,而没有对我已经工作了一段时间的项目进行测试。 是否有任何命令可以在不重新创建整个项目的情况下重新生成测试文件?
首先,您应该将 rspec gem 添加到 Gemfile 并运行 bundle 或gem install rspec
还运行rails g rspec:install
之后,您应该配置 rspec,您可以在此处查看有关本教程测试的更多信息: https : //medium.com/@sedwardscode/how-to-properly-test-a-rails-api-with-rspec-f15cbe1dfd11
https://medium.com/@lcriswell/rails-api-request-specs-with-rspec-effeac468c4e
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.