[英]RSpec > Is there a way to run all tests with one command?
Is there a command that does this?是否有执行此操作的命令? I've searched but can not find anything
我已经搜索过但找不到任何东西
在终端窗口中试试这个:
bundle exec rspec spec
if you are using rspec-rails then you can run using rake spec
如果您使用的是 rspec-rails,那么您可以使用
rake spec
运行
if you're testing models, use rake spec:models
(or rake spec:routing
or rake spec:controllers
)如果您正在测试模型,请使用
rake spec:models
(或rake spec:routing
或rake spec:controllers
)
if just testing one model, use rake SPEC=app/models/modelname.rb
如果只测试一个模型,请使用
rake SPEC=app/models/modelname.rb
.rspec
file in the root of your project.rspec
文件Add the path to where your specs are eg将路径添加到您的规格所在的位置,例如
--default-path test/spec/
Add the pattern of how your files are named eg添加文件命名方式的模式,例如
--pattern ****/*.spec
rspec
and it should pick all your specs and run them :)rspec
,它应该选择您所有的规格并运行它们:) default-path
and pattern
are simply command line arguments, which means you can also add any other command line argument that rspec takes (can run rspec --help
to see the available options) default-path
和pattern
只是命令行参数,这意味着您还可以添加 rspec 接受的任何其他命令行参数(可以运行rspec --help
以查看可用选项)
According to https://www.relishapp.com/rspec/rspec-core/v/2-0/docs/configuration/read-command-line-configuration-options-from-files you can also put the options in ~/.rspec
, which will make the options available globally.根据https://www.relishapp.com/rspec/rspec-core/v/2-0/docs/configuration/read-command-line-configuration-options-from-files你也可以把选项放在
~/.rspec
,这将使选项全局可用。 Local .rspec
file options will override the global options.本地
.rspec
文件选项将覆盖全局选项。
For controller test用于控制器测试
For model test用于模型测试
For all test对于所有测试
For specific file test do对于特定的文件测试做
go to your app directory and run rspec spec or bundle exec rspec spec .转到您的应用程序目录并运行rspec spec或bundle exec rspec spec 。 use spork to speed your testing...(i kinda say its compulsory)
使用 spork 来加速你的测试......(我有点说它是强制性的)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.