开发者

rspec spec automatic logical grouping (by "tags")

开发者 https://www.devze.com 2023-02-10 08:55 出处:网络
Is there any existing solution (a gem preferably) to run some slices of specs with rspec? for example:

Is there any existing solution (a gem preferably) to run some slices of specs with rspec?

for example:

rspec . # runs whole test suite

rspec . --keywords=project开发者_如何学编程 # runs all specs that have "project" keyword there somewhere

or something similar?


You can use tags in rspec by supplying a key-value pair to a describe, context or test, like so:

describe "A set of tests", :constraint => 'slow'
describe "Another set of tests", :focus => true

You could run either of these sets by doing:

rspec --tag constraint:slow
rspec --tag focus


I think the built-in "--example" option does what you want:

rspec . --example "project"
0

精彩评论

暂无评论...
验证码 换一张
取 消