Reputation: 21461
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
Upvotes: 2
Views: 1437
Reputation: 20724
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.
Upvotes: 4
Reputation: 21461
I changed the directory to spec
!
Now both work! :-
rspec
autotest
Upvotes: 2
Reputation: 160631
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.
Upvotes: 1