Sha256: bf0f2228568d7132e19902ead1eae1dee07766928610582e30d82ffb4a291b3f
Contents?: true
Size: 639 Bytes
Versions: 7
Compression:
Stored size: 639 Bytes
Contents
RSpec::Matchers.define :warn do |message| match do |block| output = capture_stderr(&block) message.is_a?(Regexp) ? message.match(output) : output.include?(message) end description do "warn with message \"#{message}\"" end failure_message_for_should do "expected to #{description}" end failure_message_for_should_not do "expected to not #{description}" end # Fake STDERR and return a string written to it. def capture_stderr(&block) original_stderr = $stderr $stderr = fake = StringIO.new begin yield ensure $stderr = original_stderr end fake.string end end
Version data entries
7 entries across 7 versions & 1 rubygems