I have an API that has many controllers and models.
I installed Rspec and every new resource I create, the corresponding test files are created automatically.
Is there a way to generate these files for all others old resources including REST tests?
For instance, I have a file costumers_controller.rb created before I install Rspec, is there a way to generate the default file costumers_controller_spec.rb?
I found the answer:
rails g rspec:scaffold controller_name
This generate also the request and routing file.
In order to generate the model just use:
rails g rspec:model model_name
And all test files will be ready to use.
Thanks.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句