Benjamin Tan Wei Hao
Benjamin Tan Wei Hao

Reputation: 9691

Globbing doesn't work with Minitest - Only one file is run

I have placed all my specs in specs/*.rb.

However, when I run Minitest with ruby spec/**/*_spec.rb, only one file is run.

What gives?

Upvotes: 3

Views: 1082

Answers (2)

Gabe Martin-Dempesy
Gabe Martin-Dempesy

Reputation: 7975

You can use the testrbl third party gem to run multiple Minitest files on the command line. You could also use the mtest bin from maxitest extensions.

Using a for loop in bash will incur overhead of loading your application/library for every test you pass it. If you have just ten tests, and you're testing a Rails app that takes 5 seconds to boot, that's over a minute of totally unnecessary load time.

Upvotes: 1

Oscar Del Ben
Oscar Del Ben

Reputation: 4515

This is not minitest specific, but Ruby. You are effectively running a ruby program which knows nothing about the program being run.

Ruby does not support running multiple files at once afaik, so if you want to get a similar result you could try something like:

for file in spec/**/*_spec.rb; do ruby $file; done

UPDATE: for what you want you should probably create a Rake task as described here

Upvotes: 3

Related Questions