You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some reason Spring sets working folder to that from where the command was launched instead of keeping it as RAILS_ROOT. It looks like Rails testing framework expects it that way and thus gets broken. Steps to reproduce with Rails 6.1.1:
rails new spring_test
cd spring_test
bundle exec rails generate scaffold Model name:text
bundle exec rails db:migrate
bundle exec rails test
All is good and we see something like
Running via Spring preloader in process 3209
/home/mlt/.rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/application.rb:204: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
Run options: --seed 25091
# Running:
.......
Finished in 0.714637s, 9.7952 runs/s, 12.5938 assertions/s.
7 runs, 9 assertions, 0 failures, 0 errors, 0 skips
Now let's move to some project subfolder
cd db
bundle exec rails test
No tests are found because they are being looked for at the wrong place, i.e. db/test/**/*_test.rb.
Running via Spring preloader in process 3381
/home/mlt/.rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/application.rb:204: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
Run options: --seed 47427
# Running:
Finished in 0.000600s, 0.0000 runs/s, 0.0000 assertions/s.
Everything gets back to normal once we disable Spring:
[mlt@host db]$ bundle exec rails test
Running via Spring preloader in process 4037
/home/mlt/.rvm/gems/ruby-2.6.6/gems/spring-2.1.0/lib/spring/application.rb:199: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
Run options: --seed 44870
# Running:
.......
Finished in 18.512508s, 0.3781 runs/s, 0.4862 assertions/s.
7 runs, 9 assertions, 0 failures, 0 errors, 0 skips
For some reason Spring sets working folder to that from where the command was launched instead of keeping it as RAILS_ROOT. It looks like Rails testing framework expects it that way and thus gets broken. Steps to reproduce with Rails 6.1.1:
All is good and we see something like
Now let's move to some project subfolder
No tests are found because they are being looked for at the wrong place, i.e.
db/test/**/*_test.rb
.Everything gets back to normal once we disable Spring:
The text was updated successfully, but these errors were encountered: