Run tagged specifications or ALL if no tags are available

I use guards with rspec and cucumber. To run selected specifications continuously, I just use the focus tag to nail what I want to work.

But the problem is that I want to run all the specifications if there are no specifications with this tag.

How can i do this?

NOTE. . I know all the parameters of RSpec. Therefore, please answer only after you read the question .

+6
source share
2 answers

I get the behavior you described with the following configuration:

 # to run only specific specs, add :focus to the spec # describe "foo", :focus do # OR # it "should foo", :focus do config.treat_symbols_as_metadata_keys_with_true_values = true # default in rspec 3 config.filter_run :focus => true config.run_all_when_everything_filtered = true 
+7
source

Have you considered using Autotest? This gives you more or less the same behavior without the need for tags.

0
source

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


All Articles