ruby - can I use multiple exclusion filters in rspec? -


in _spec.rb file i'm setting exclusion filter like:

rspec.configure |config|   # need determine once @ front   # , result available in instance   server_success = server1_available?    config.exclusion_filter = {     :svr1 => lambda {|what|       case       when :available         !server_success       end     }   } end 

and later in file do

describe :get_items_by_client, :svr1 => :available 

to prevent test execution if server isn't available.

this works fine if run spec file alone. however, have similar code in file controlling tests access different server, , when run them see each of server checks done (i have puts in "serverx_available?" code), 1 set of tests being excluded (even though neither server available).

i'm starting think can have single exclusion filter, can find docs anywhere speak that. doable on per-file basis? have single complex filter in support file, how incorporated when i'm doing run of single spec-file?

ideally, i'd find form works per-file let's me availability check once since expensive check , have several examples in test controlled that.

config.filter_run_excluding :cost => true config.filter_run_excluding :slow => true 

try out , works.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -