Class: DeepTest::Spec::WorkResult

Inherits:
Object
  • Object
show all
Includes:
CentralCommand::Result
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.



8
9
10
11
# File 'lib/deep_test/spec/work_result.rb', line 8

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.



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

def identifier
  @identifier
end

#outputObject (readonly)

Returns the value of attribute output.



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

def output
  @output
end

Instance Method Details

#==(other) ⇒ Object



17
18
19
20
# File 'lib/deep_test/spec/work_result.rb', line 17

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

#deadlock_resultObject



30
31
32
# File 'lib/deep_test/spec/work_result.rb', line 30

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

#errorObject



13
14
15
# File 'lib/deep_test/spec/work_result.rb', line 13

def error
  @error.resolve if @error
end

#failed_due_to_deadlock?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/deep_test/spec/work_result.rb', line 22

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

#success?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/deep_test/spec/work_result.rb', line 26

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