2

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
Ian Vaughan
  • 20,211
  • 13
  • 59
  • 79

3 Answers3

4

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.

lucapette
  • 20,564
  • 6
  • 65
  • 59
2

I changed the directory to spec!

Now both work! :-

rspec
autotest
Ian Vaughan
  • 20,211
  • 13
  • 59
  • 79
1

Change your test directory to tests. That should make autotest happier.

From autotest --help:

It assumes the code is in lib, and tests are in tests.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • Ah, looked like a winner, but, alas no, I've updated the OP to show the code output. – Ian Vaughan Dec 08 '11 at 07:25
  • 1
    Umm 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. – lucapette Dec 08 '11 at 08:44
  • @lucapette for some reason, I completely ignored your reply! Hence my post is exactly what you put! You should make it an answer and I'll accept it! – Ian Vaughan Dec 13 '11 at 10:46