我的Ruby-on-Rails应用程序中没有命令“rails test”

问题描述 投票:0回答:1

我最近加入了一个关于Ruby-on-Rails应用程序的团队,我尝试审核测试。没有测试,所以我决定在应用程序中实现它们。

在看到那里有什么之后,我看到没有命令可以运行测试。我运行了以下命令:

 rails --tasks

在输出中,没有诸如rails testrails test:system之类的命令。令人惊讶的是,我可以成功运行命令rails test。但命令rails test:system --trace失败,输出如下:

 rails aborted!
 Don't know how to build task 'test:system' (see --tasks)
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/task_manager.rb:59:in `[]'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:159:in `invoke_task'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `each'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/command.rb:48:in `invoke'
 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/commands.rb:18:in `<top (required)>'
 bin/rails:9:in `require'
 bin/rails:9:in `<main>'

我尝试在新创建的应用程序中运行该命令,我可以看到可用的命令rails testrails test:system

rails --tasks

知道命令rails test:system失败的原因吗?谢谢。

Ruby版本:2.3.3

Rails版本:5.2.0

编辑:

我正在使用MiniTest

ruby-on-rails system-testing
1个回答
0
投票

要在一次运行中运行所有规格:

rspec

要执行特定的测试文件:

rspec <path to the file>  # rspec spec/controllers/mytest_spec.rb

使用--format documentation格式化输出。

如果bundle exec抛出依赖性错误,则前置rspec

© www.soinside.com 2019 - 2024. All rights reserved.