Class: RSpec::Conductor::ConductorFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/conductor/worker.rb

Instance Method Summary collapse

Constructor Details

#initialize(socket, file, shutdown_check) ⇒ ConductorFormatter

Returns a new instance of ConductorFormatter.



201
202
203
204
205
# File 'lib/rspec/conductor/worker.rb', line 201

def initialize(socket, file, shutdown_check)
  @socket = socket
  @file = file
  @shutdown_check = shutdown_check
end

Instance Method Details

#example_failed(notification) ⇒ Object



218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/rspec/conductor/worker.rb', line 218

def example_failed(notification)
  ex = notification.example
  @socket.send_message(
    type: :example_failed,
    file: @file,
    description: ex.full_description,
    location: ex.location,
    run_time: ex.execution_result.run_time,
    exception_class: ex.execution_result.exception&.class&.name,
    message: ex.execution_result.exception&.message,
    backtrace: format_backtrace(ex.execution_result.exception&.backtrace, ex.)
  )
  @shutdown_check.call
end

#example_passed(notification) ⇒ Object



207
208
209
210
211
212
213
214
215
216
# File 'lib/rspec/conductor/worker.rb', line 207

def example_passed(notification)
  @socket.send_message(
    type: :example_passed,
    file: @file,
    description: notification.example.full_description,
    location: notification.example.location,
    run_time: notification.example.execution_result.run_time
  )
  @shutdown_check.call
end

#example_pending(notification) ⇒ Object



233
234
235
236
237
238
239
240
241
242
243
# File 'lib/rspec/conductor/worker.rb', line 233

def example_pending(notification)
  ex = notification.example
  @socket.send_message(
    type: :example_pending,
    file: @file,
    description: ex.full_description,
    location: ex.location,
    pending_message: ex.execution_result.pending_message
  )
  @shutdown_check.call
end

#retry(ex) ⇒ Object



245
246
247
248
249
250
251
252
253
254
# File 'lib/rspec/conductor/worker.rb', line 245

def retry(ex)
  @socket.send_message(
    type: :example_retried,
    description: ex.full_description,
    location: ex.location,
    exception_class: ex.exception&.class&.name,
    message: ex.exception&.message,
    backtrace: format_backtrace(ex.exception&.backtrace, ex.)
  )
end