Class: ChatNotifier::Messenger::Failure

Inherits:
ChatNotifier::Messenger show all
Defined in:
lib/chat_notifier/messenger.rb

Instance Attribute Summary

Attributes inherited from ChatNotifier::Messenger

#app, #environment, #repository, #summary

Instance Method Summary collapse

Methods inherited from ChatNotifier::Messenger

debug=, #digest, #failures, for, #identifier, #initialize, #resolved?, #thread_key, #to_h, #to_hash

Constructor Details

This class inherits a constructor from ChatNotifier::Messenger

Instance Method Details

#bodyObject



135
136
137
# File 'lib/chat_notifier/messenger.rb', line 135

def body
  failures.flat_map(&:location).join("\n")
end

#countObject



107
# File 'lib/chat_notifier/messenger.rb', line 107

def count = "#{failures.size} times!"

#failure?Boolean

Returns:

  • (Boolean)


113
# File 'lib/chat_notifier/messenger.rb', line 113

def failure? = !success?

#ledeObject



119
120
121
122
123
124
125
# File 'lib/chat_notifier/messenger.rb', line 119

def lede
  <<~LEDE.chomp
    #{message_prefix} #{identifier} has failed #{count} in #{branch}

    #{environment.test_run_url}
  LEDE
end

#messageObject



127
128
129
130
131
132
133
# File 'lib/chat_notifier/messenger.rb', line 127

def message
  <<~MESSAGE.chomp
    #{lede}

    #{body}
  MESSAGE
end

#message_prefixObject



109
# File 'lib/chat_notifier/messenger.rb', line 109

def message_prefix = ":boom:"

#status_reportObject



115
116
117
# File 'lib/chat_notifier/messenger.rb', line 115

def status_report
  super.merge(status: "failed", failures: failures.size)
end

#success?Boolean

Returns:

  • (Boolean)


111
# File 'lib/chat_notifier/messenger.rb', line 111

def success? = false