Sha256: 9036a390235259bbcdd585dc21f6b1356abcf42d5b808d4a70c4da2942533330
Contents?: true
Size: 993 Bytes
Versions: 1
Compression:
Stored size: 993 Bytes
Contents
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'rubocop' # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories. Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} 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 RSpec.configure do |config| config.include(ExitCodeMatchers) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.1.0 | spec/spec_helper.rb |