Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run tagged specs or ALL if no tags available

I'm using guard with rspec and cucumber. To run the selected specs continuously, I just use focus tag to nail what I want to work on.

But the problem is that I want to ran all of the specs if there are no specs with that tag.

How can I do that?

NOTE:: I am aware of all the RSpec options. So please reply only after you've read the question.

like image 724
Dmytrii Nagirniak Avatar asked Nov 11 '11 03:11

Dmytrii Nagirniak


1 Answers

I achieve the behavior you've described with the following config:

# 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
like image 77
John Bachir Avatar answered Oct 07 '22 01:10

John Bachir