class RSpec::Github::NotificationDecorator

Constants

ESCAPE_MAP

See github.community/t/set-output-truncates-multiline-strings/16852/3.

Public Class Methods

new(notification) click to toggle source
# File lib/rspec/github/notification_decorator.rb, line 13
def initialize(notification)
  @notification = notification
end

Public Instance Methods

annotation() click to toggle source
# File lib/rspec/github/notification_decorator.rb, line 21
def annotation
  "#{example.full_description}\n\n#{message}"
    .gsub(Regexp.union(ESCAPE_MAP.keys), ESCAPE_MAP)
end
line() click to toggle source
# File lib/rspec/github/notification_decorator.rb, line 17
def line
  example.location.split(':')[1]
end
path() click to toggle source
# File lib/rspec/github/notification_decorator.rb, line 26
def path
  # TODO: use `delete_prefix` when dropping ruby 2.4 support
  File.realpath(raw_path).sub(/\A#{workspace}#{File::SEPARATOR}/, '')
end

Private Instance Methods

example() click to toggle source
# File lib/rspec/github/notification_decorator.rb, line 33
def example
  @notification.example
end
message() click to toggle source
# File lib/rspec/github/notification_decorator.rb, line 37
def message
  if @notification.respond_to?(:message_lines)
    @notification.message_lines.join("\n")
  else
    "#{example.skip ? 'Skipped' : 'Pending'}: #{example.execution_result.pending_message}"
  end
end
raw_path() click to toggle source
# File lib/rspec/github/notification_decorator.rb, line 45
def raw_path
  example.location.split(':')[0]
end
workspace() click to toggle source
# File lib/rspec/github/notification_decorator.rb, line 49
def workspace
  File.realpath(ENV.fetch('GITHUB_WORKSPACE', '.'))
end