如何在Rspec中使用--order选项来订购文件

时间:2015-09-15 10:57:31

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

我希望以固定顺序运行rspec/capybara中编写的功能规范,如下所示:

signup_spec.rb
login_spec.rb
project_creation_spec.rb
project_migration_spec.rb

given here--order功能说明了

Use the --order option to tell RSpec how to order the files, groups, and
examples

我如何使用.rspec文件来提及我的要求?

我有一个shell脚本,测试用例按以下顺序运行:

rspec spec/features/signup_spec.rb
rspec spec/features/login_spec.rb
rspec spec/features/project_creation_spec.rb
rspec spec/features/project_migration_spec.rb

1 个答案:

答案 0 :(得分:1)

订单选项不允许这样做。它允许在默认排序之间切换(基本上它们按照定义的顺序运行,而这依赖于文件系统排序)或随机排序(可选择使用种子)

我会认为任何顺序依赖都是一个错误 - 随机排序选项可以清除这些错误。