projectile
guesses the test file name given a source file by adding suffix/prefix to your source file. For example, if you have a hello.rb
then it tries to find a file called hello_test.rb
in your project.
It by default has some rules that maps from project type to test suffix/prefix. Here is the actual code:
(defun projectile-test-suffix (project-type)
"Find default test files suffix based on PROJECT-TYPE."
(cond
((member project-type '(rails-rspec ruby-rspec)) "_spec")
((member project-type '(rails-test ruby-test lein-test go)) "_test")
((member project-type '(scons)) "test")
((member project-type '(maven symfony)) "Test")
((member project-type '(gradle grails)) "Spec")))
If you don't see anything in projectile-find-test-file
that means most likely it cannot find anything related to your source file by adding suffix/prefix.
This can be customized via projectile-test-suffix-function
. By default the variable points to the function above, but you can override it with your own rules.
rails-rspec
is stored as a property list using a call toprojectile-register-project-type
, and then the suffix information is picked off by a call toprojectile-project-type-attribute
throughprojectile-test-suffix
. Just in case you were looking for the above code like I was. – Jin