rspec规范自动逻辑分组(通过"标签")

ror*_*dev 3 ruby tags components rspec ruby-on-rails

是否有任何现有的解决方案(最好是宝石)用rspec运行一些规格片?

例如:
rspec . # runs whole test suite
rspec . --keywords=project # runs all specs that have "project" keyword there somewhere

或类似的东西?

Tim*_*onk 9

您可以通过向描述,上下文或测试提供键值对来在rspec中使用标记,如下所示:

describe "A set of tests", :constraint => 'slow'
describe "Another set of tests", :focus => true
Run Code Online (Sandbox Code Playgroud)

您可以执行以下任一操作:

rspec --tag constraint:slow
rspec --tag focus
Run Code Online (Sandbox Code Playgroud)