Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created May 28, 2017 18:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myronmarston/bfcdd5c9adcb51b5c3e31603d884afd6 to your computer and use it in GitHub Desktop.
Save myronmarston/bfcdd5c9adcb51b5c3e31603d884afd6 to your computer and use it in GitHub Desktop.
How to make RSpec fail if anything outputs
RSpec::Matchers.define_negated_matcher :avoid_outputting, :output
RSpec.configure do |config|
config.around do |ex|
expect(&ex).to avoid_outputting.to_stdout.and avoid_outputting.to_stderr
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment