Rake test does not recognize new folder inside test folder

When I run rake test, it does not run the tests in the new folder that I created.

By default, Rails has this folder inside the test folder:
 enter image description here

When I run the test, i.e. rake test, it checks the contents of the test folder.

I added an api folder inside the test folder.
enter image description here

The contents of the api folder are checked when I do this: rake test:run TEST=test/api/users_test.rb

But, when I just do rake test, it does not check the contents of the api folder. How to configure it?

+4
source share
1 answer

rake test:all should run all tests in subdirectories of the test folder, not even the default.

rake test:api: Do rake -w test | grep '^rake test', ( railties), Rails . test.rake , Rails . lib/tasks/test.rake :

Rails::TestTask.new('api' => "test:prepare") do |t|
  t.pattern = "test/api/**/*_test.rb"
end
+3

Source: https://habr.com/ru/post/1539424/


All Articles