以下命令有效:
rake spec:models
rake spec:controllers
rake spec:requests
但以下没有:
rake spec:integration
rake spec:integrations
如何单独运行所有集成测试?
以下命令有效:
rake spec:models
rake spec:controllers
rake spec:requests
但以下没有:
rake spec:integration
rake spec:integrations
如何单独运行所有集成测试?
一种选择是使用rspec spec/integration/*
我猜。
我希望得到一个像其他方法一样与 rake 一起使用的答案。
实际上,请求规范是rspec 中的集成测试。有些测试是从 test::unit 继承的吗?
Test::Unit 是使用生成器创建的新 Rails 应用程序的默认测试库(除非指定了 -T 以跳过 test::unit 文件的创建),因此它将附带规范/集成,而对于 Rspec,约定是使用规范/请求。实际上,如果您现在尝试通过 生成新的 integration_test rails g integration_test testname
,那将进入请求。