Class: DeepTest::Spec::WorkResult

Inherits:
Object
  • Object
show all
Defined in:
lib/deep_test/spec/work_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier, error, output) ⇒ WorkResult

Returns a new instance of WorkResult.



6
7
8
9
# File 'lib/deep_test/spec/work_result.rb', line 6

def initialize(identifier, error, output)
  @identifier, @output = identifier, output
  @error = MarshallableExceptionWrapper.new error if error
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



4
5
6
# File 'lib/deep_test/spec/work_result.rb', line 4

def identifier
  @identifier
end

#outputObject (readonly)

Returns the value of attribute output.



4
5
6
# File 'lib/deep_test/spec/work_result.rb', line 4

def output
  @output
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
18
# File 'lib/deep_test/spec/work_result.rb', line 15

def ==(other)
  identifier == other.identifier && 
      @error == other.instance_variable_get(:@error) 
end

#deadlock_resultObject



28
29
30
# File 'lib/deep_test/spec/work_result.rb', line 28

def deadlock_result
  WorkResult.new(identifier, nil, '-deadlock-')
end

#errorObject



11
12
13
# File 'lib/deep_test/spec/work_result.rb', line 11

def error
  @error.resolve if @error
end

#failed_due_to_deadlock?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/deep_test/spec/work_result.rb', line 20

def failed_due_to_deadlock?
  DeadlockDetector.due_to_deadlock?(@error)
end

#success?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/deep_test/spec/work_result.rb', line 24

def success?
  error.nil? || ::Spec::Example::ExamplePendingError === error
end