I am trying to spec behaviors for command line arguments my script receives to ensure that all validation passes. Some of my command line arguments will result in abort or exit being invoked because the parameters supplied are missing or incorrect. I am trying something like this which isn't working: # something_spec.rb require 'something' describe Something do before do Kernel.stub!(:exit) end it