Sha256: 1e149ffc3f9422005522fea81a438e703a524b41efed394e6f211b88396c4d9a
Contents?: true
Size: 710 Bytes
Versions: 1
Compression:
Stored size: 710 Bytes
Contents
require 'expect' module Spectus # This class evaluate the expectation with the passed block. # class Sandbox < BasicObject attr_reader :exception, :got # Execute the untested code from the passed block against the definition. # # @param [Hash] definition def initialize(definition, &actual) @got = ::Expect.this(&actual).to(definition) rescue => e @exception = e end # Return the result as a positive or a negative assertion. # # @param [Boolean] negate # # @return [Boolean] Report if the test was true or false. def pass?(negate) if defined?(@exception) false else negate ^ @got end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spectus-2.0.0 | lib/spectus/sandbox.rb |