我不能让rspec自动测试工作? (Ruby,没有轨道)

时间:2011-12-07 22:09:51

标签: ruby rspec autotest

我有一个基本的ruby项目: -

$ tree
.
├── Gemfile
├── lib
│   ├── checkout.rb
│   └── item.rb
├── README.md
└── test
    ├── checkout_spec.rb
    └── item_spec.rb

哪个可以运行rspec测试: -

$ rspec test/*_spec.rb
....

Finished in 0.18797 seconds
4 examples, 0 failures

但是谁想要每秒向上箭头并按下输入,我想要自动测试...

但是当我运行它时,它并没有找到我的测试!

$ autotest -vw
No tests matched Gemfile
No tests matched README.md
No tests matched lib/checkout.rb
No tests matched lib/item.rb
No tests matched test/checkout_spec.rb
No tests matched test/item_spec.rb

然后我开始保存文件: -

{"lib/checkout.rb"=>2011-12-07 22:06:04 +0000}
No tests matched lib/checkout.rb
{"lib/checkout.rb"=>2011-12-07 22:06:04 +0000}
No tests matched lib/checkout.rb
{"test/.goutputstream-NQC45V"=>2011-12-07 22:06:20 +0000}
No tests matched test/.goutputstream-NQC45V
{"test/.goutputstream-NQC45V"=>2011-12-07 22:06:20 +0000}
No tests matched test/.goutputstream-NQC45V
{"lib/checkout.rb"=>2011-12-07 22:06:45 +0000}
No tests matched lib/checkout.rb
{"lib/checkout.rb"=>2011-12-07 22:06:45 +0000}
No tests matched lib/checkout.rb
<just sits here

我已经阅读了.autotestspec_helper.rb,但似乎可以在正确的搜索/页面上找到它?


编辑:锡人发现的帮助与我的布局之间存在明显的不匹配。

但是将我的test更改为tests并没有帮助!: -

No tests matched tests/checkout_spec.rb
No tests matched tests/item_spec.rb
No tests matched tests/rule_parser_spec.rb
No tests matched tests/runner.rb
No tests matched tests/spec_helper.rb
{"lib/rule_parser.rb"=>2011-12-08 07:24:29 +0000}
No tests matched lib/rule_parser.rb
{"lib/rule_parser.rb"=>2011-12-08 07:24:29 +0000}
No tests matched lib/rule_parser.rb
{"tests/checkout_spec.rb"=>2011-12-08 07:24:35 +0000}
No tests matched tests/checkout_spec.rb
{"tests/checkout_spec.rb"=>2011-12-08 07:24:35 +0000}
No tests matched tests/checkout_spec.rb

3 个答案:

答案 0 :(得分:4)

我认为您应该将其更改为规格。我不使用自动测试,但最新版本的rspec假设你有一个规范目录到项目的根目录。所以我应该自动测试。

答案 1 :(得分:2)

我将目录更改为spec

现在两个都有效! : -

rspec
autotest

答案 2 :(得分:1)

将您的test目录更改为tests。这应该让自动测试更快乐。

来自autotest --help

  

它假定代码在lib中,测试在测试中。