Sha256: f302bd48c0a290348603283711993f516538936e2080736897fc56804b39db31
Contents?: true
Size: 770 Bytes
Versions: 10
Compression:
Stored size: 770 Bytes
Contents
require 'rubygems' require 'spec' require 'mocha' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'iconoclasm' Spec::Runner.configure do |config| config.mock_with :mocha end # It bothers me that mocha doesn't have this built-in. # It also bothers me that I forked mocha but didn't add this. # We are all at fault. module Mocha class Expectation def throws(symbol, object = nil) @return_values += ReturnValues.new(SymbolThrower.new(symbol, object)) self end end class SymbolThrower def initialize(symbol, object) @symbol = symbol @object = object end def evaluate @object ? throw(@symbol, @object) : throw(@symbol) end end end
Version data entries
10 entries across 10 versions & 1 rubygems