Sha256: 05249f44e555d75ff91595436a4a2fa9fbe49b2381ea9cc7ff6d7633feb6d8cd
Contents?: true
Size: 803 Bytes
Versions: 4
Compression:
Stored size: 803 Bytes
Contents
module Spec class ShouldBase def default_message(expectation, expected=:no_expectation_specified) message = wrap(@target) message += " #{expectation}" if (expected != :no_expectation_specified) message += " " + wrap(expected) end message end def wrap(obj) if obj == true "<true>" elsif obj == false "<false>" elsif obj.nil? "nil" elsif obj.kind_of? Proc "<Proc>" elsif (obj.kind_of? Array) || (obj.kind_of? String) "#{obj.inspect}" elsif obj.inspect.include? "<" "#{obj.class} #{obj.inspect}" else "#{obj.class} <#{obj.inspect}>" end end def fail_with_message(message) Kernel::raise(Spec::Api::ExpectationNotMetError.new(message)) end end end
Version data entries
4 entries across 4 versions & 1 rubygems