Rspec spec automatic logical grouping (by tags)

Is there any existing solution (preferably a gem) for running some spec snippets using rspec?

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

or something similar?

+3
source share
2 answers

You can use tags in rspec by providing a key-value pair for description, context, or test, for example:

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

You can run any of these sets by doing:

rspec --tag constraint:slow
rspec --tag focus
+9
source

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

rspec . --example "project"
+4
source

Source: https://habr.com/ru/post/1792233/


All Articles