简体   繁体   English

将 RSpec 升级到版本 3 后,我无法再运行单个规范文件

[英]after upgrading RSpec to version 3 I can't run single spec file anymore

We are in the process of upgrading rails from 3.4 to 4.2.我们正在将 rails 从 3.4 升级到 4.2。 When we upgraded the rspec to the latest version, even after forcing the rspec to run only one spec it runs around 900 tests but my file only hast two contexts.当我们将 rspec 升级到最新版本时,即使在强制 rspec 只运行一个规范之后,它也会运行大约 900 个测试,但我的文件只有两个上下文。 I use something similar to this command :我使用类似于这个命令的东西:

rspec spec/myfile_spec.rb

What can be wrong?有什么问题? Is it something that I can fix in spec_helper?我可以在 spec_helper 中修复它吗? I d

Hope you are fine!希望你没事! You can just run the spec you want by the following commands.您可以通过以下命令运行您想要的规范。

# Default: Run all spec files (i.e., those matching spec/**/*_spec.rb)
$ bundle exec rspec

# Run all spec files in a single directory (recursively)
$ bundle exec rspec spec/models

# Run a single spec file
$ bundle exec rspec spec/controllers/accounts_controller_spec.rb

# Run a single example from a spec file (by line number)
$ bundle exec rspec spec/controllers/accounts_controller_spec.rb:8

# See all options for running specs
$ bundle exec rspec --help

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM