ror_dev
ror_dev

Reputation: 31

rspec spec automatic logical grouping (by "tags")

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?

Upvotes: 3

Views: 2499

Answers (2)

Paul Horsfall
Paul Horsfall

Reputation: 8192

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

rspec . --example "project"

Upvotes: 4

Timon Vonk
Timon Vonk

Reputation: 449

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

Upvotes: 9

Related Questions