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

别来无恙 提交于 2020-01-04 15:14:54

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/12048579/globbing-doesnt-work-with-minitest-only-one-file-is-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!