ruby - What can I check to see if rspec is running? -
ruby - What can I check to see if rspec is running? -
so ruby libraries double executables, using trick:
if __file__ == $0 # deed executable... end
i'm writing mini-library, , wondering if there similar trick utilize embed rspec tests in file. sort of constant or check, like:
if rspec_target == $0 describe 'foo' "should foo" #... end end
argv
contains name of script. utilize next in modules:
if argv.include? file.basename(__file__) # unit tests here end
ruby rspec
Comments
Post a Comment