Class: Perchfall::Notify::SlackFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/perchfall/notify/slack_formatter.rb

Overview

Converts a Perchfall::Report into a Slack Block Kit payload Hash.

The default format posts a concise status message with:

- pass/fail indicator
- URL and scenario name (if present)
- HTTP status and duration
- counts of network and console errors (if any)

Inject a custom formatter into Channels::Slack to change message shape.

Instance Method Summary collapse

Instance Method Details

#format(report) ⇒ Hash

Returns Slack Block Kit payload.

Parameters:

  • report (Perchfall::Report)

Returns:

  • (Hash) —

    Slack Block Kit payload



17
18
19
20
21
22
23
24
25
# File 'lib/perchfall/notify/slack_formatter.rb', line 17

def format(report)
  {
    blocks: [
      header_block(report),
      details_block(report),
      *error_blocks(report)
    ]
  }
end