I've been looking through the docs, but descriptions of how multiple filters work seem to be a bit lacking. Does anyone have a good explanation or source of a good explanation for the behaviour of multiple filters? Does the order they are listed matter? Here's an example of code that might have behaviour other than what one could expect...
Rspec.configure do |c|
this_version = get_version_number.to_sym
c.filter_run :focus=> true
c.filter_run_excluding :limit_to=>true, this_version => false
c.filter_run :new_stuff=>true
c.run_all_when_everything_filtered
end
it "is focused, but not new", :focus
it "is is new", :new_stuff
it "is new and focused", :new_stuff, :focus
it "is focused and new, but limited to a different version", :focus, :limit_to, :correct_version
Experimenting with this, it also seems like multiple arguments on the "filter_run_excluding" line simple act is if you wrote the line multiple times. Is there a way to get it to actually combine the filter checks so that it excludes (or runs, I suppose) only examples that have both the tags listed?
Run multiple filters from the command line with this:
rspec spec --tag my_tag --tag my_second_tag -- tag ~my_third_tag
The ~ will exclude any spec with those tags, so its often useful to do something like
rspec spec --tag ~long_runing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With