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

时间:2017-07-20 00:19:21

标签: ruby ruby-on-rails-3 rspec rspec-rails rspec3

我们正在将rails从3.4升级到4.2。当我们将rspec升级到最新版本时,即使在强制rspec只运行一个规范后它运行大约900次测试,但我的文件只有两个上下文。我使用类似于这个命令的东西:

rspec spec/myfile_spec.rb

有什么不对?这是我可以在spec_helper中修复的东西吗?我

1 个答案:

答案 0 :(得分:0)

希望你没事! 您可以通过以下命令运行您想要的规范。

# 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