Class: DeepTest::Spec::WorkUnit

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

Defined Under Namespace

Classes: ResultReporter

Instance Method Summary collapse

Constructor Details

#initialize(identifier) ⇒ WorkUnit

Returns a new instance of WorkUnit.



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

def initialize(identifier)
  @identifier = identifier
end

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/deep_test/spec/work_unit.rb', line 8

def run
  # Dup options here to avoid clobbering the reporter on someone
  # elses options reference (Such as ExampleGroupRunner)
  original_options = ::Spec::Runner.options
  ::Spec::Runner.use ::Spec::Runner.options.dup
  ::Spec::Runner.options.reporter = ResultReporter.new(@identifier)
  result = run_without_deadlock_protection
  result = run_without_deadlock_protection if result.failed_due_to_deadlock?
  result = result.deadlock_result if result.failed_due_to_deadlock?
  result
ensure
  ::Spec::Runner.use original_options
end

#to_sObject



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

def to_s
  "#{@identifier.group_description}: #{@identifier.description}"
end