Sha256: b11b558fa9396ecb9b25d1c7a0c9a72580d8c75ccfaca0b6029452a31ae095f0
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
module Defekt class Test attr_reader :methot, :error def initialize(methot) @methot = methot end def instance @instance ||= methot.owner.new end def run @ran = true begin instance.before if instance.respond_to?(:before) methot.bind(instance).call '.' rescue => e @error = e status.chars.first ensure instance.after if instance.respond_to?(:after) end end def summary "#{methot.owner}##{methot.name} at #{methot.source_location.join(':')} #{status}" end def ran? !!@ran end def passed? ran? && error.nil? end def failed? ran? && !passed? && error.kind_of?(Errors::BaseError) end def errored? ran? && !failed? && error.kind_of?(Exception) end def broken? failed? || errored? end def status case when passed? 'passed' when failed? 'failed' when errored? 'errored' else 'did not run' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
defekt-0.0.7 | lib/defekt/test.rb |