我在机器上的其他项目中使用了自动测试。我现在正在做一个使用 rspec 的小 ruby 项目。
我可以用rspec spec
运行测试,它们都运行。
我已经在我的Gemfile
中添加了"自动测试",我已经bundle
了。
我可以运行autotest
但它无法运行我的 rspec 测试spec/
我添加了空.rspec
和.autotest
文件。
我尝试了autotest
和autotest-standalone
宝石。
我已经查看了 http://ph7spot.com/musings/getting-started-with-autotest#troubleshooting_autotest_test_detection 的所有信息,这很有帮助,但没有解决我的问题。
原来我需要(但没有)
gem 'rspec'
在我的宝石文件中(当然还有bundle
)
我没有意识到这一点,因为在我的机器上使用其他项目的 rspec 以及因此能够"手动"执行rspec spec
,我没有意识到我需要明确列出 gem,即在 Gemfile 中。
我还验证了:
- 我确实需要 .rspec 文件如果它是空的没关系,但它需要存在。
它可以在 *nix 上使用touch .rspec
创建。 - 我不需要
.autotest
文件。