我无法让 rspec 自动测试正常工作? (红宝石,无导轨)
我有一个基本的 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
但是谁想每秒向上箭头并按 Enter 键,我想要自动测试...
但是当我运行它时,它找不到我的测试!
$ 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
我已经阅读了 .autotest
和 spec_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
I have a basic ruby project :-
$ tree
.
├── Gemfile
├── lib
│ ├── checkout.rb
│ └── item.rb
├── README.md
└── test
├── checkout_spec.rb
└── item_spec.rb
Which can run the rspec tests :-
$ rspec test/*_spec.rb
....
Finished in 0.18797 seconds
4 examples, 0 failures
But who wants to up-arrow and press enter every sec, I wanted autotest...
But when I run it, it doesn't find my tests!
$ 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
Then I start saving files :-
{"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
I've read about .autotest
and spec_helper.rb
, but can seem to home in on the correct search/page?
Edit: A well spotted mismatch between the help and my layout spotted by the tin man.
But changing my test
to tests
did not help!:-
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为你应该将其更改为规格。我不使用自动测试,但最新版本的 rspec 假设您的项目根目录中有一个规范目录。我想应该自动测试。
I think you should change it to spec. I don't use autotest but the latest versions of rspec assume you have a spec dir in to root of your project. So should autotest I guess.
我将目录更改为
spec
!现在两者都工作了! :-
I changed the directory to
spec
!Now both work! :-
将您的
test
目录更改为tests
。这应该会让自动测试更快乐。来自
autotest --help
:Change your
test
directory totests
. That should make autotest happier.From
autotest --help
: