Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference in running a rails unit test with -Ilib and -Itest?

I use both the following commands to run tests in my application:

ruby -Ilib test/unit/account_test.rb
ruby -Itest test/unit/account_test.rb

Both works fine. But, what is the difference. What actually the flag -I means?

like image 589
Virtual Avatar asked Dec 06 '25 17:12

Virtual


1 Answers

From the Ruby manual page (man ruby):

 -I directory   Used to tell Ruby where to load the library scripts.  Direc‐
                tory path will be added to the load-path variable ($:).

The variable $: (aliased as $LOAD_PATH) is the array of directories where Ruby looks for files to load when you call require. In your case both commands works well because, I guess, you don't require anything inside lib or test directories from your test code.

like image 132
toro2k Avatar answered Dec 08 '25 08:12

toro2k



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!