class Defekt::Test
Attributes
error[R]
methot[R]
Public Class Methods
new(methot)
click to toggle source
# File lib/defekt/test.rb, line 5 def initialize(methot) @methot = methot end
Public Instance Methods
broken?()
click to toggle source
# File lib/defekt/test.rb, line 48 def broken? failed? || errored? end
errored?()
click to toggle source
# File lib/defekt/test.rb, line 44 def errored? ran? && !failed? && error.kind_of?(Exception) end
failed?()
click to toggle source
# File lib/defekt/test.rb, line 40 def failed? ran? && !passed? && error.kind_of?(Errors::BaseError) end
instance()
click to toggle source
# File lib/defekt/test.rb, line 9 def instance @instance ||= methot.owner.new end
passed?()
click to toggle source
# File lib/defekt/test.rb, line 36 def passed? ran? && error.nil? end
ran?()
click to toggle source
# File lib/defekt/test.rb, line 32 def ran? !!@ran end
run()
click to toggle source
# File lib/defekt/test.rb, line 13 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
status()
click to toggle source
# File lib/defekt/test.rb, line 52 def status case when passed? 'passed' when failed? 'failed' when errored? 'errored' else 'did not run' end end
summary()
click to toggle source
# File lib/defekt/test.rb, line 28 def summary "#{methot.owner}##{methot.name} at #{methot.source_location.join(':')} #{status}" end