Sha256: 80956afb0c5bfa2302bd7fa8c0044fe83b044102d73c0e01a85ad09f5e311d08
Contents?: true
Size: 702 Bytes
Versions: 1
Compression:
Stored size: 702 Bytes
Contents
# See: How can I validate exits and aborts in RSpec? # http://stackoverflow.com/questions/1480537 module ExitCodeMatchers RSpec::Matchers.define :exit_with_code do |code| actual = nil match do |block| begin block.call rescue SystemExit => e actual = e.status end actual and actual == code end failure_message_for_should do |block| "expected block to call exit(#{code}) but exit" + (actual.nil? ? " not called" : "(#{actual}) was called") end failure_message_for_should_not do |block| "expected block not to call exit(#{code})" end description do "expect block to call exit(#{code})" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scaffolder-tools-0.1.3 | spec/support/exit_code_matcher.rb |